From 39e285257eb4a43982e9419049d9661391dfdbad Mon Sep 17 00:00:00 2001 From: Matthew Skinner Date: Fri, 19 May 2023 21:53:43 +1000 Subject: [PATCH] [mqtt.espmilighthub] Fix things do not come ONLINE if MQTT Client Status Topic not supplied. (#14877) * Update readme and add new thing status message. Signed-off-by: Matthew Skinner --- bundles/org.openhab.binding.mqtt.espmilighthub/README.md | 3 +++ .../espmilighthub/internal/handler/EspMilightHubHandler.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.mqtt.espmilighthub/README.md b/bundles/org.openhab.binding.mqtt.espmilighthub/README.md index 0ced3f94524..3c1af7827a8 100644 --- a/bundles/org.openhab.binding.mqtt.espmilighthub/README.md +++ b/bundles/org.openhab.binding.mqtt.espmilighthub/README.md @@ -42,6 +42,9 @@ Leave this blank. **mqtt_state_topic_pattern:** `milight/states/:device_id/:device_type/:group_id` +**MQTT Client Status Topic:** +`milight/status` + **group_state_fields:** IMPORTANT: Make sure only the following are ticked: diff --git a/bundles/org.openhab.binding.mqtt.espmilighthub/src/main/java/org/openhab/binding/mqtt/espmilighthub/internal/handler/EspMilightHubHandler.java b/bundles/org.openhab.binding.mqtt.espmilighthub/src/main/java/org/openhab/binding/mqtt/espmilighthub/internal/handler/EspMilightHubHandler.java index 73e3139122d..48fef50fdcc 100644 --- a/bundles/org.openhab.binding.mqtt.espmilighthub/src/main/java/org/openhab/binding/mqtt/espmilighthub/internal/handler/EspMilightHubHandler.java +++ b/bundles/org.openhab.binding.mqtt.espmilighthub/src/main/java/org/openhab/binding/mqtt/espmilighthub/internal/handler/EspMilightHubHandler.java @@ -487,7 +487,7 @@ public class EspMilightHubHandler extends BaseThingHandler implements MqttMessag updateStatus(ThingStatus.ONLINE); } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, - "Milight Hub is not connected to your MQTT broker."); + "Waiting for 'milight/status: connected' MQTT message to be sent from your ESP Milight hub."); } } else { try { @@ -537,6 +537,8 @@ public class EspMilightHubHandler extends BaseThingHandler implements MqttMessag return; } this.connection = connection; + updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.CONFIGURATION_PENDING, + "Waiting for 'milight/status: connected' MQTT message to be received. Check hub has 'MQTT Client Status Topic' configured."); connection.subscribe(fullStatesTopic, this); connection.subscribe(STATUS_TOPIC, this); }