File tree 1 file changed +10
-2
lines changed
usermods/PIR_sensor_switch
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ class PIRsensorSwitch : public Usermod
71
71
bool m_offOnly = false ;
72
72
bool m_offMode = offMode;
73
73
bool m_override = false ;
74
-
74
+
75
75
// Home Assistant
76
76
bool HomeAssistantDiscovery = false ; // is HA discovery turned on
77
77
int16_t idx = -1 ; // Domoticz virtual switch idx
@@ -317,7 +317,15 @@ void PIRsensorSwitch::publishHomeAssistantAutodiscovery()
317
317
device[F (" mf" )] = F (WLED_BRAND);
318
318
device[F (" mdl" )] = F (WLED_PRODUCT_NAME);
319
319
device[F (" sw" )] = versionString;
320
-
320
+
321
+ String mqtt_avail_topic = mqttDeviceTopic;
322
+ mqtt_avail_topic += F (" /status" );
323
+ doc[F (" avty_t" )] = mqtt_avail_topic.c_str ();
324
+ JsonArray connections = device[F (" connections" )].createNestedArray ();
325
+ connections.add (F (" mac" ));
326
+ connections.add (WiFi.macAddress ());
327
+ connections.add (F (" ip" ));
328
+ connections.add (WiFi.localIP ().toString ());
321
329
sprintf_P (buf, PSTR (" homeassistant/binary_sensor/%s/config" ), uid);
322
330
DEBUG_PRINTLN (buf);
323
331
size_t payload_size = serializeJson (doc, json_str);
You can’t perform that action at this time.
0 commit comments