Skip to content

Commit

Permalink
修复自发现 重启HA无效
Browse files Browse the repository at this point in the history
  • Loading branch information
qlwz committed Jan 16, 2020
1 parent 6cef68d commit a5b1302
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/Cover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ void Cover::mqttDiscovery(boolean isEnable)
sprintf(message, HASS_DISCOVER_COVER, UID, mqtt->getCmndTopic(F("set")).c_str(), mqtt->getStatTopic(F("position")).c_str(),
mqtt->getCmndTopic(F("set_position")).c_str(), mqtt->getTeleTopic(F("availability")).c_str());
Debug.AddLog(LOG_LEVEL_INFO, PSTR("discovery: %s - %s"), topic, message);
mqtt->publish(topic, message);
mqtt->publish(topic, message, true);
}
else
{
mqtt->publish(topic, "");
mqtt->publish(topic, "", true);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Relay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ void Relay::mqttDiscovery(boolean isEnable)
Relay::channels == 1 ? powerTopic.c_str() : (powerTopic + (ch + 1)).c_str(),
mqtt->getTeleTopic(F("availability")).c_str());
Debug.AddLog(LOG_LEVEL_INFO, PSTR("discovery: %s - %s"), topic, message);
mqtt->publish(topic, message);
mqtt->publish(topic, message, true);
}
else
{
mqtt->publish(topic, "");
mqtt->publish(topic, "", true);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Weile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ void Weile::mqttDiscovery(boolean isEnable)
powerTopic.c_str(),
mqtt->getTeleTopic(F("availability")).c_str());
Debug.AddLog(LOG_LEVEL_INFO, PSTR("discovery: %s - %s"), topic, message);
mqtt->publish(topic, message);
mqtt->publish(topic, message, true);
}
else
{
mqtt->publish(topic, "");
mqtt->publish(topic, "", true);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/Zinguo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,11 @@ void Zinguo::mqttDiscovery(boolean isEnable)
mqtt->getStatTopic(tims[i]).c_str(),
mqtt->getTeleTopic(F("availability")).c_str());
Debug.AddLog(LOG_LEVEL_INFO, PSTR("discovery: %s - %s"), topic, message);
mqtt->publish(topic, message);
mqtt->publish(topic, message, true);
}
else
{
mqtt->publish(topic, "");
mqtt->publish(topic, "", true);
}
}

Expand All @@ -277,11 +277,11 @@ void Zinguo::mqttDiscovery(boolean isEnable)
mqtt->getStatTopic("temp").c_str(),
mqtt->getTeleTopic(F("availability")).c_str());
Debug.AddLog(LOG_LEVEL_INFO, PSTR("discovery: %s - %s"), topic, message);
mqtt->publish(topic, message);
mqtt->publish(topic, message, true);
}
else
{
mqtt->publish(topic, "");
mqtt->publish(topic, "", true);
}
}
#pragma endregion
Expand Down

0 comments on commit a5b1302

Please sign in to comment.