Browse Source

Implement availability topic for home assistant (#280)

fastled
Xose Pérez 6 years ago
parent
commit
1839faced6
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      code/espurna/homeassitant.ino

+ 4
- 0
code/espurna/homeassitant.ino View File

@ -31,6 +31,9 @@ void haSend(bool add) {
root["command_topic"] = getTopic(MQTT_TOPIC_RELAY, 0, true); root["command_topic"] = getTopic(MQTT_TOPIC_RELAY, 0, true);
root["payload_on"] = String("1"); root["payload_on"] = String("1");
root["payload_off"] = String("0"); root["payload_off"] = String("0");
root["availability_topic"] = getTopic(MQTT_TOPIC_STATUS, false);
root["payload_available"] = String("1");
root["payload_not_available"] = String("0");
} }
#if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE #if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE
@ -65,6 +68,7 @@ void haSend(bool add) {
"/config"; "/config";
mqttSendRaw(topic.c_str(), output.c_str()); mqttSendRaw(topic.c_str(), output.c_str());
mqttSend(MQTT_TOPIC_STATUS, 1);
} }


Loading…
Cancel
Save