mirror of https://github.com/arendst/Tasmota.git
Added HASS_STATE to command STATE
The command STATE has a secondary mqtt message in the case that SETOPTION59 is 1 This adds a HASS_STATE mqtt message if HomeAssistant discovery is enabled. This is useful for syncing HomeAssistant with all the states of a Tasmota device when HA is restarted. The actual automation for HA explained in the wiki will also make use of this new message.
This commit is contained in:
parent
83188c926c
commit
f4da1d1d86
|
@ -615,6 +615,11 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
|||
if (Settings.flag3.hass_tele_on_power) {
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_STATE), MQTT_TELE_RETAIN);
|
||||
}
|
||||
#ifdef USE_HOME_ASSISTANT
|
||||
if (Settings.flag.hass_discovery) {
|
||||
HAssPublishStatus();
|
||||
}
|
||||
#endif // USE_HOME_ASSISTANT
|
||||
}
|
||||
else if (CMND_SLEEP == command_code) {
|
||||
if ((payload >= 0) && (payload < 251)) {
|
||||
|
|
Loading…
Reference in New Issue