Просмотр исходного кода

update example env and mqtt mock classs

Fabio De Simone 11 месяцев назад
Родитель
Сommit
fc5b570529
2 измененных файлов с 40 добавлено и 8 удалено
  1. 29 7
      .env.example
  2. 11 1
      dune_weaver_flask/modules/mqtt/mock.py

+ 29 - 7
.env.example

@@ -1,17 +1,39 @@
 # MQTT Configuration
-# Required for real MQTT implementation (leave empty for mock implementation)
+# this configuration is needed to activat ethe integration with Home assistant
+# If you leave MQTT_BROKER empty, the integration will be skipped, and it won't affect the app in any way
+# to correctly configure the integration, you must copy this .env.example to a fine named just .env
+# and then fill all the fields
+
+# the ip address of your mqtt server
+# if you have the mosquitto addon, this is the same as the Home assistant IP
 MQTT_BROKER=
+# the port of the mqtt broker, 1883 is the default port
 MQTT_PORT=1883
+# the username and password can either be the ones of a Home Assistant user (if you're using the addon)
+# or a specific mqtt user (see https://github.com/home-assistant/addons/blob/master/mosquitto/DOCS.md)
 MQTT_USERNAME=
 MQTT_PASSWORD=
+
+# Status update interval in seconds
+# most of the updates are done on demand anyway, so you probably don't need to edit this
+MQTT_STATUS_INTERVAL=30  
+
+# Home Assistant MQTT Discovery
+# this is usually homeassistant
+# if you didn't edit it yourself in your install, leave as is
+MQTT_DISCOVERY_PREFIX=homeassistant
+
+
+
+# unique ids: you need to edit these only if you have multiple tables that you want to connect to Home assistant
+# unique id of the devvice in Home Assistant
+HA_DEVICE_ID=dune_weaver
+# unique id of the device in mqtt
 MQTT_CLIENT_ID=dune_weaver
+# display name of the table in Home assistant
+HA_DEVICE_NAME=Dune Weaver
 
 # MQTT Topics
+# you can probably leave this as is
 MQTT_STATUS_TOPIC=dune_weaver/status
 MQTT_COMMAND_TOPIC=dune_weaver/command
-MQTT_STATUS_INTERVAL=30  # Status update interval in seconds
-
-# Home Assistant MQTT Discovery
-MQTT_DISCOVERY_PREFIX=homeassistant
-HA_DEVICE_NAME=Sand Table
-HA_DEVICE_ID=dune_weaver

+ 11 - 1
dune_weaver_flask/modules/mqtt/mock.py

@@ -1,5 +1,7 @@
 """Mock MQTT handler implementation."""
+from typing import Dict, Callable
 from .base import BaseMQTTHandler
+from dune_weaver_flask.modules.core.state import state
 
 
 
@@ -21,4 +23,12 @@ class MockMQTTHandler(BaseMQTTHandler):
     @property
     def is_enabled(self) -> bool:
         """Always returns False since this is a mock."""
-        return False 
+        return False
+        
+    def publish_status(self) -> None:
+        """Mock status publisher."""
+        pass
+        
+    def setup_ha_discovery(self) -> None:
+        """Mock discovery setup."""
+        pass