[ONOFF] ON OFF behavior fixes (#1828)

-Avoid plug restart in case of OverCurrent detection, introduced with central queue add
-publish uselaststate value
-if uselaststate is false we switch off the relay at restart
This commit is contained in:
Florian authored and GitHub committed 2023-12-07 15:48:06 -06:00
1 parent 87cb2fecd2
commit 8c8dc6b6f6
3 files changed
+17 -11

No files matched your search

+3 -2
View File
@@ -949,7 +949,7 @@ void pubMqttDiscovery() {
# ifdef ZactuatorONOFF
Log.trace(F("actuatorONOFFDiscovery" CR));
char* actuatorONOFF[8] = {"switch", "actuatorONOFF", "", "", "", "{\"cmd\":1}", "{\"cmd\":0}", ""};
char* actuatorONOFF[8] = {"switch", "actuatorONOFF", "", "", "{{ value_json.cmd }}", "{\"cmd\":1}", "{\"cmd\":0}", ""};
//component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement
//trc(actuatorONOFF[1]);
@@ -959,7 +959,8 @@ void pubMqttDiscovery() {
actuatorONOFF[5], actuatorONOFF[6], actuatorONOFF[7],
0, Gateway_AnnouncementMsg, will_Message, true, subjectMQTTtoONOFF,
"", "", "", "", false, // device name, device manufacturer, device model, device ID, retain
stateClassNone //State Class
stateClassNone, //State Class
"0", "1" //state_off, state_on
);
# endif