mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Change json messages
This commit is contained in:
parent
a7d7c0d668
commit
d84707a667
@ -237,31 +237,9 @@ void dispatch_output_idle_state(uint8_t state)
|
|||||||
|
|
||||||
void IRAM_ATTR dispatch_send_obj_attribute_str(uint8_t pageid, uint8_t btnid, const char * attribute, const char * data)
|
void IRAM_ATTR dispatch_send_obj_attribute_str(uint8_t pageid, uint8_t btnid, const char * attribute, const char * data)
|
||||||
{
|
{
|
||||||
#if !defined(HASP_USE_MQTT) && !defined(HASP_USE_TASMOTA_SLAVE)
|
char payload[44 + strlen(data) + strlen(attribute)];
|
||||||
Log.notice(TAG_MSGR, F("json = {\"p[%u].b[%u].%s\":\"%s\"}"), pageid, btnid, attribute, data);
|
snprintf_P(payload, sizeof(payload), PSTR("{\"page\":%u,\"id\":%u,\"%s\":\"%s\"}"), pageid, btnid, attribute, data);
|
||||||
#else
|
dispatch_state_msg(F("json"), payload);
|
||||||
#if HASP_USE_MQTT > 0
|
|
||||||
mqtt_send_obj_attribute_str(pageid, btnid, attribute, data);
|
|
||||||
#endif
|
|
||||||
#if HASP_USE_TASMOTA_SLAVE > 0
|
|
||||||
slave_send_obj_attribute_str(pageid, btnid, attribute, data);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// send return output back to the client
|
|
||||||
void IRAM_ATTR dispatch_obj_attribute_str(uint8_t pageid, uint8_t btnid, const char * attribute, const char * data)
|
|
||||||
{
|
|
||||||
#if !defined(HASP_USE_MQTT) && !defined(HASP_USE_TASMOTA_SLAVE)
|
|
||||||
Log.notice(TAG_MSGR, F("json = {\"p[%u].b[%u].%s\":\"%s\"}"), pageid, btnid, attribute, data);
|
|
||||||
#else
|
|
||||||
#if HASP_USE_MQTT > 0
|
|
||||||
mqtt_send_obj_attribute_str(pageid, btnid, attribute, data);
|
|
||||||
#endif
|
|
||||||
#if HASP_USE_TASMOTA_SLAVE > 0
|
|
||||||
slave_send_obj_attribute_str(pageid, btnid, attribute, data);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get or Set a part of the config.json file
|
// Get or Set a part of the config.json file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user