event support JSON payload

This commit is contained in:
Barbudor 2021-06-27 18:58:40 +02:00
parent 80f18a53e1
commit 51744bf645
1 changed files with 4 additions and 1 deletions

View File

@ -913,7 +913,10 @@ void RulesEvery50ms(void)
} else {
parameter = event + strlen(event); // '\0'
}
snprintf_P(json_event, sizeof(json_event), PSTR("{\"Event\":{\"%s\":\"%s\"}}"), event, parameter);
if (parameter[0]=='{')
snprintf_P(json_event, sizeof(json_event), PSTR("{\"Event\":{\"%s\":%s}}"), event, parameter);
else
snprintf_P(json_event, sizeof(json_event), PSTR("{\"Event\":{\"%s\":\"%s\"}}"), event, parameter);
Rules.event_data[0] ='\0';
RulesProcessEvent(json_event);
} else {