1
mirror of https://github.com/home-assistant/core synced 2024-09-06 10:29:55 +02:00

Fix colorTemperatureInKelvin in Alexa report when light is off (#27107)

* Fixes #26405 Return None if light state is off since attribute is unavailable, prevents property from being reported with invalid value of 0.

* Update Test to check property is not reported when light state is off.
This commit is contained in:
ochlocracy 2019-10-02 18:59:21 -04:00 committed by Jason Hu
parent c43eeee62f
commit 9c1feacd47
2 changed files with 3 additions and 3 deletions

View File

@ -326,7 +326,7 @@ class AlexaColorTemperatureController(AlexaCapibility):
return color_util.color_temperature_mired_to_kelvin(
self.entity.attributes["color_temp"]
)
return 0
return None
class AlexaPercentageController(AlexaCapibility):

View File

@ -294,8 +294,8 @@ async def test_report_colored_temp_light_state(hass):
)
properties = await reported_properties(hass, "light.test_off")
properties.assert_equal(
"Alexa.ColorTemperatureController", "colorTemperatureInKelvin", 0
properties.assert_not_has_property(
"Alexa.ColorTemperatureController", "colorTemperatureInKelvin"
)