Fixed wrong ct results when initializing device

This commit is contained in:
Stephan Hadinger 2019-04-18 20:56:18 +02:00
parent d2f1657e68
commit 599306a81f
2 changed files with 3 additions and 2 deletions

View File

@ -657,7 +657,7 @@ uint16_t LightGetColorTemp(void)
// for Alexa, send back the original CT value if close enough
// avoids rounding errors
if ((ct > _light_ct ? ct - _light_ct : _light_ct - ct) < 5)
if ((ct > _light_ct ? ct - _light_ct : _light_ct - ct) > 5)
_light_ct = ct;
return _light_ct;
}

View File

@ -592,7 +592,8 @@ void HueLightStatus1(uint8_t device, String *response)
light_status += "\"sat\":" + String((uint8_t)(254.0f * sat + 0.5f)) + ",";
}
if (LST_COLDWARM == light_subtype || LST_RGBWC == light_subtype) { // white temp
light_status += "\"ct\":" + String(ct) + ",";
// ct = 0 is non valid, so we put 284 as default value (medium white)
light_status += "\"ct\":" + String( (ct < 100) ? 284 : ct) + ",";
}
response->replace("{light_status}", light_status);
response->replace("{m}", g_gotct?"ct":"hs");