From 6b05b62099d0f3e584e91d6c04c1cfa6dd9b44f5 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 29 Jun 2021 10:46:56 +0200 Subject: [PATCH] Save some bytes --- tasmota/xdrv_10_rules.ino | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tasmota/xdrv_10_rules.ino b/tasmota/xdrv_10_rules.ino index 14c52f7c8..ffcc9fcf6 100644 --- a/tasmota/xdrv_10_rules.ino +++ b/tasmota/xdrv_10_rules.ino @@ -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 {