Merge branch 'master' into update-check
This commit is contained in:
36
Network.cpp
36
Network.cpp
@@ -514,6 +514,7 @@ bool Network::reconnect()
|
||||
}
|
||||
|
||||
publishString(_maintenancePathPrefix, mqtt_topic_mqtt_connection_state, "online");
|
||||
publishString(_maintenancePathPrefix, mqtt_topic_info_nuki_hub_ip, _device->localIP().c_str());
|
||||
|
||||
_mqttConnectionState = 2;
|
||||
for(const auto& callback : _reconnectedCallbacks)
|
||||
@@ -752,6 +753,18 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
|
||||
json["dev"]["mf"] = "Nuki";
|
||||
json["dev"]["mdl"] = deviceType;
|
||||
json["dev"]["name"] = name;
|
||||
|
||||
String cuUrl = _preferences->getString(preference_mqtt_hass_cu_url);
|
||||
|
||||
if (cuUrl != "")
|
||||
{
|
||||
json["dev"]["cu"] = cuUrl;
|
||||
}
|
||||
else
|
||||
{
|
||||
json["dev"]["cu"] = "http://" + _device->localIP();
|
||||
}
|
||||
|
||||
json["~"] = baseTopic;
|
||||
json["name"] = nullptr;
|
||||
json["unique_id"] = String(uidString) + "_lock";
|
||||
@@ -953,6 +966,23 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
|
||||
{ { "enabled_by_default", "true" },
|
||||
{"ic", "mdi:counter"}});
|
||||
|
||||
// NUKI Hub IP Address
|
||||
publishHassTopic("sensor",
|
||||
"nuki_hub_ip",
|
||||
uidString,
|
||||
"_nuki_hub_ip",
|
||||
"NUKI Hub IP",
|
||||
name,
|
||||
baseTopic,
|
||||
_lockPath + mqtt_topic_info_nuki_hub_ip,
|
||||
deviceType,
|
||||
"",
|
||||
"",
|
||||
"diagnostic",
|
||||
"",
|
||||
{ { "enabled_by_default", "true" },
|
||||
{"ic", "mdi:ip"}});
|
||||
|
||||
// LED enabled
|
||||
publishHassTopic("switch",
|
||||
"led_enabled",
|
||||
@@ -1427,6 +1457,12 @@ void Network::removeHASSConfig(char* uidString)
|
||||
path.concat(uidString);
|
||||
path.concat("/sound_level/config");
|
||||
_device->mqttPublish(path.c_str(), MQTT_QOS_LEVEL, true, "");
|
||||
|
||||
path = discoveryTopic;
|
||||
path.concat("/sensor/");
|
||||
path.concat(uidString);
|
||||
path.concat("/nuki_hub_ip/config");
|
||||
_device->mqttPublish(path.c_str(), MQTT_QOS_LEVEL, true, "");
|
||||
|
||||
path = discoveryTopic;
|
||||
path.concat("/number/");
|
||||
|
||||
Reference in New Issue
Block a user