mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 19:59:50 +03:00
fix
This commit is contained in:
18
lighthub/mqtt.cpp
Normal file
18
lighthub/mqtt.cpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
int mqtt::publish(int value)
|
||||||
|
{};
|
||||||
|
|
||||||
|
int mqtt::publish(float value)
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
int mqtt::publish(char * value)
|
||||||
|
{
|
||||||
|
char addrstr[MQTT_TOPIC_LENGTH];
|
||||||
|
aJsonObject *emit = aJson.getObjectItem(in, "emit");
|
||||||
|
strncpy(addrstr,emit->valuestring,sizeof(addrstr));
|
||||||
|
if (!strchr(addrstr,'/')) setTopic(addrstr,sizeof(addrstr),T_OUT,emit->valuestring);
|
||||||
|
if mqttClient.connected() mqttClient.publish(addrstr, value, true);
|
||||||
|
};
|
||||||
|
*/
|
||||||
Reference in New Issue
Block a user