mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 13:46:36 +00:00
Fix HASP_USE_HA compile errors #237
This commit is contained in:
parent
3d37f84a4b
commit
2e7a772668
@ -16,9 +16,14 @@
|
||||
|
||||
#define RETAINED true
|
||||
|
||||
// extern char mqttNodeName[16];
|
||||
#if defined(WINDOWS) || defined(POSIX)
|
||||
extern std::string mqttNodeTopic;
|
||||
extern std::string mqttGroupTopic;
|
||||
#else
|
||||
extern char mqttNodeTopic[];
|
||||
extern char mqttGroupTopic[];
|
||||
#endif
|
||||
|
||||
extern bool mqttEnabled;
|
||||
extern bool mqttHAautodiscover;
|
||||
|
||||
|
@ -99,13 +99,12 @@ bool mqtt_send_lwt(bool online)
|
||||
{
|
||||
char tmp_payload[8];
|
||||
char tmp_topic[strlen(mqttNodeTopic) + 4];
|
||||
|
||||
strncpy(tmp_topic, mqttNodeTopic, sizeof(tmp_topic));
|
||||
strncat_P(tmp_topic, PSTR(MQTT_TOPIC_LWT), sizeof(tmp_topic));
|
||||
// snprintf_P(tmp_topic, sizeof(tmp_topic), PSTR("%s" MQTT_TOPIC_LWT), mqttNodeTopic);
|
||||
|
||||
size_t len = snprintf_P(tmp_payload, sizeof(tmp_payload), online ? PSTR("online") : PSTR("offline"));
|
||||
bool res = mqttPublish(tmp_topic, tmp_payload, len, true);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user