Save some bytes

This commit is contained in:
Theo Arends 2021-06-29 10:46:56 +02:00
parent 744b83dae2
commit 6b05b62099
1 changed files with 2 additions and 4 deletions

View File

@ -913,10 +913,8 @@ void RulesEvery50ms(void)
} else {
parameter = event + strlen(event); // '\0'
}
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);
bool quotes = (parameter[0] != '{');
snprintf_P(json_event, sizeof(json_event), PSTR("{\"Event\":{\"%s\":%s%s%s}}"), event, (quotes)?"\"":"", parameter, (quotes)?"\"":"");
Rules.event_data[0] ='\0';
RulesProcessEvent(json_event);
} else {