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 authored and Jason Hu committed 2019-10-02 15:59:21 -07:00
1 parent c43eeee62f
commit 9c1feacd47
2 files changed
+3 -3

No files matched your search

@@ -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):
+2 -2
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"
)