浏览代码

current_disc_state_topic_disc

Karl Hudgell 6 月之前
父节点
当前提交
67ef8209f4
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      lib/mqtt.py

+ 4 - 4
lib/mqtt.py

@@ -36,15 +36,15 @@ def create_config(client: mqtt.Client) -> None:
 
     # Define discovery and state topics for each sensor
     discovery_topic_disc = f"homeassistant/sensor/floppy_player/current_disc/config"
-    state_topic_disc = f"homeassistant/sensor/floppy_player/current_disc/state"
+    current_disc_state_topic_disc = f"homeassistant/sensor/floppy_player/current_disc/state"
 
     discovery_topic_status = f"homeassistant/sensor/floppy_player/status/config"
     state_topic_status = f"homeassistant/sensor/floppy_player/status/state"
 
     # Sensor 1: current_disc (a text-based sensor)
-    disc_config = {
+    current_disc_config = {
         "name": "Current Disc",
-        "state_topic": state_topic_disc,
+        "state_topic": current_disc_state_topic_disc,
         "value_template": "{{ value }}",  # Textual value
         "unique_id": f"{node_id}_current_disc",
         "device": {
@@ -68,7 +68,7 @@ def create_config(client: mqtt.Client) -> None:
             "manufacturer": "Karl"
         }
     }
-    client.publish(discovery_topic_disc, json.dumps(disc_config), retain=True)
+    client.publish(discovery_topic_disc, json.dumps(current_disc_config), retain=True)
     client.publish(discovery_topic_status, json.dumps(status_config), retain=True)