From fb42293631cd6e2ebac03a38561a52f7dedc59b5 Mon Sep 17 00:00:00 2001 From: Ian Taylor Date: Tue, 21 Nov 2023 03:49:04 -0700 Subject: [PATCH] [DISC] Set "retain":false within autodiscovery messages for Home Assistant and OpenHAB discovery switch. (#1814) As discovery state is stored in flash memory and there is an auto off timer, we don't want discovery turned back on by a retained MQTT message when device reboots. --- main/ZmqttDiscovery.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/ZmqttDiscovery.ino b/main/ZmqttDiscovery.ino index 52102b2f..9817097f 100644 --- a/main/ZmqttDiscovery.ino +++ b/main/ZmqttDiscovery.ino @@ -502,7 +502,7 @@ void pubMqttDiscovery() { "{\"discovery\":true,\"save\":true}", "{\"discovery\":false,\"save\":true}", "", //set,payload_on,payload_off,unit_of_meas, 0, //set off_delay Gateway_AnnouncementMsg, will_Message, true, subjectMQTTtoSYSset, //set,payload_avalaible,payload_not avalaible ,is a gateway entity, command topic - "", "", "", "", true, // device name, device manufacturer, device model, device MAC, retain, + "", "", "", "", false, // device name, device manufacturer, device model, device MAC, retain, stateClassNone, //State Class "false", "true" //state_off, state_on ); @@ -512,7 +512,7 @@ void pubMqttDiscovery() { "{\"ohdiscovery\":true,\"save\":true}", "{\"ohdiscovery\":false,\"save\":true}", "", //set,payload_on,payload_off,unit_of_meas, 0, //set off_delay Gateway_AnnouncementMsg, will_Message, true, subjectMQTTtoSYSset, //set,payload_avalaible,payload_not avalaible ,is a gateway entity, command topic - "", "", "", "", true, // device name, device manufacturer, device model, device MAC, retain, + "", "", "", "", false, // device name, device manufacturer, device model, device MAC, retain, stateClassNone, //State Class "false", "true" //state_off, state_on );