Skip to content

Commit

Permalink
Implement availability topic for home assistant (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoseperez committed Nov 20, 2017
1 parent b3c980d commit 1839fac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions code/espurna/homeassitant.ino
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ void haSend(bool add) {
root["command_topic"] = getTopic(MQTT_TOPIC_RELAY, 0, true);
root["payload_on"] = String("1");
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
Expand Down Expand Up @@ -65,6 +68,7 @@ void haSend(bool add) {
"/config";

mqttSendRaw(topic.c_str(), output.c_str());
mqttSend(MQTT_TOPIC_STATUS, 1);

}

Expand Down

0 comments on commit 1839fac

Please sign in to comment.