mirror of https://github.com/arendst/Tasmota.git
Merge pull request #4450 from emontnemery/hass_send_tele
WIP - Support sending tele/STATUS as state/RESULT
This commit is contained in:
commit
eb851a9a90
|
@ -72,7 +72,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
|
|||
uint32_t use_wifi_scan : 1; // bit 6 (v6.3.0.10)
|
||||
uint32_t use_wifi_rescan : 1; // bit 7 (v6.3.0.10)
|
||||
uint32_t receive_raw : 1; // bit 8 (v6.3.0.11)
|
||||
uint32_t spare09 : 1;
|
||||
uint32_t hass_tele_as_result : 1; // bit 9
|
||||
uint32_t spare10 : 1;
|
||||
uint32_t spare11 : 1;
|
||||
uint32_t spare12 : 1;
|
||||
|
|
|
@ -1681,7 +1681,11 @@ void PerformEverySecond(void)
|
|||
|
||||
mqtt_data[0] = '\0';
|
||||
MqttShowState();
|
||||
if (Settings.flag3.hass_tele_as_result) {
|
||||
MqttPublishPrefixTopic_P(STAT, S_RSLT_RESULT, MQTT_TELE_RETAIN);
|
||||
} else {
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_STATE), MQTT_TELE_RETAIN);
|
||||
}
|
||||
|
||||
mqtt_data[0] = '\0';
|
||||
if (MqttShowSensor()) {
|
||||
|
|
|
@ -426,6 +426,7 @@ void HAssDiscovery(uint8_t mode)
|
|||
if (Settings.flag.hass_discovery) {
|
||||
Settings.flag.mqtt_response = 0; // Response always as RESULT and not as uppercase command
|
||||
Settings.flag.decimal_text = 1; // Respond with decimal color values
|
||||
Settings.flag3.hass_tele_as_result = 1; // send tele/STATE message as stat/RESULT
|
||||
// Settings.light_scheme = 0; // To just control color it needs to be Scheme 0
|
||||
if (!string_ends_with(Settings.mqtt_fulltopic, "%prefix%/"))
|
||||
strncpy_P(Settings.mqtt_fulltopic, PSTR("%topic%/%prefix%/"), sizeof(Settings.mqtt_fulltopic));
|
||||
|
|
Loading…
Reference in New Issue