From 859156c3950c7224adbcddf5fe3ae83327100c20 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Sat, 17 Aug 2019 11:06:49 +0200 Subject: [PATCH] Fix #6247 --- sonoff/sonoff.ino | 2 +- sonoff/xdrv_04_light.ino | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 9d2892ed3..0ee89ac72 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -631,7 +631,7 @@ void MqttShowState(void) for (uint32_t i = 1; i <= devices_present; i++) { #ifdef USE_LIGHT - if (i >= light_device) { + if ((light_device) && (i >= light_device)) { if (i == light_device) { LightState(1); } // call it only once } else { #endif diff --git a/sonoff/xdrv_04_light.ino b/sonoff/xdrv_04_light.ino index e7755c587..4968d7ea4 100644 --- a/sonoff/xdrv_04_light.ino +++ b/sonoff/xdrv_04_light.ino @@ -1643,10 +1643,10 @@ void LightState(uint8_t append) GetPowerDevice(scommand, light_device + i, sizeof(scommand), 1); uint32_t light_power_masked = light_power & (1 << i); // the light_power value for this device light_power_masked = light_power_masked ? 1 : 0; // convert to on/off - ResponseAppend_P(PSTR("\"%s\":\"%s\",\"" D_CMND_CHANNEL "%d\":%d"), scommand, GetStateText(light_power_masked), light_device + i, + ResponseAppend_P(PSTR("\"%s\":\"%s\",\"" D_CMND_CHANNEL "%d\":%d,"), scommand, GetStateText(light_power_masked), light_device + i, changeUIntScale(light_current_color[i], 0, 255, 0, 100)); } - ResponseAppend_P(PSTR(",\"" D_CMND_COLOR "\":\"%s\""), LightGetColor(scolor)); + ResponseAppend_P(PSTR("\"" D_CMND_COLOR "\":\"%s\""), LightGetColor(scolor)); } // light_pwm_multi_channels if (!append) {