mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-11 16:06:38 +02:00
HASS - MQTT Retained Messages
In #104 durch @KG3RK3N vorgeschlagen und von mir smoke-getestet. Scheint den gewünschten Erfolg zu bringen.
This commit is contained in:
parent
6dba1d7577
commit
193802aae4
2 changed files with 4 additions and 4 deletions
|
@ -39,15 +39,15 @@ class mqtt {
|
|||
//DPRINTLN(DBG_VERBOSE, F("mqtt.h:sendMsg"));
|
||||
char top[64];
|
||||
snprintf(top, 64, "%s/%s", mTopic, topic);
|
||||
sendMsg2(top, msg);
|
||||
sendMsg2(top, msg, false);
|
||||
}
|
||||
|
||||
void sendMsg2(const char *topic, const char *msg) {
|
||||
void sendMsg2(const char *topic, const char *msg, boolean retained) {
|
||||
if(mAddressSet) {
|
||||
if(!mClient->connected())
|
||||
reconnect();
|
||||
if(mClient->connected())
|
||||
mClient->publish(topic, msg);
|
||||
mClient->publish(topic, msg, retained);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue