mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 08:55:22 +01:00
Always send all light state values in API (#2150)
This commit is contained in:
parent
d2cd65f5db
commit
9efeea14f2
1 changed files with 9 additions and 16 deletions
|
@ -310,22 +310,15 @@ bool APIConnection::send_light_state(light::LightState *light) {
|
||||||
resp.key = light->get_object_id_hash();
|
resp.key = light->get_object_id_hash();
|
||||||
resp.state = values.is_on();
|
resp.state = values.is_on();
|
||||||
resp.color_mode = static_cast<enums::ColorMode>(color_mode);
|
resp.color_mode = static_cast<enums::ColorMode>(color_mode);
|
||||||
if (color_mode & light::ColorCapability::BRIGHTNESS)
|
resp.brightness = values.get_brightness();
|
||||||
resp.brightness = values.get_brightness();
|
resp.color_brightness = values.get_color_brightness();
|
||||||
if (color_mode & light::ColorCapability::RGB) {
|
resp.red = values.get_red();
|
||||||
resp.color_brightness = values.get_color_brightness();
|
resp.green = values.get_green();
|
||||||
resp.red = values.get_red();
|
resp.blue = values.get_blue();
|
||||||
resp.green = values.get_green();
|
resp.white = values.get_white();
|
||||||
resp.blue = values.get_blue();
|
resp.color_temperature = values.get_color_temperature();
|
||||||
}
|
resp.cold_white = values.get_cold_white();
|
||||||
if (color_mode & light::ColorCapability::WHITE)
|
resp.warm_white = values.get_warm_white();
|
||||||
resp.white = values.get_white();
|
|
||||||
if (color_mode & light::ColorCapability::COLOR_TEMPERATURE)
|
|
||||||
resp.color_temperature = values.get_color_temperature();
|
|
||||||
if (color_mode & light::ColorCapability::COLD_WARM_WHITE) {
|
|
||||||
resp.cold_white = values.get_cold_white();
|
|
||||||
resp.warm_white = values.get_warm_white();
|
|
||||||
}
|
|
||||||
if (light->supports_effects())
|
if (light->supports_effects())
|
||||||
resp.effect = light->get_effect_name();
|
resp.effect = light->get_effect_name();
|
||||||
return this->send_light_state_response(resp);
|
return this->send_light_state_response(resp);
|
||||||
|
|
Loading…
Reference in a new issue