Return 'None' for light attributes when off instead of removing them (#101946)

This commit is contained in:
Paul Bottein 2023-10-19 01:08:08 +02:00 committed by GitHub
parent 606b76c681
commit c98c18f25e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 363 additions and 111 deletions

View file

@ -114,7 +114,7 @@ async def test_switch_read_light_state_dimmer(hass: HomeAssistant, utcnow) -> No
# Initial state is that the light is off
state = await helper.poll_and_get_state()
assert state.state == "off"
assert ATTR_COLOR_MODE not in state.attributes
assert state.attributes[ATTR_COLOR_MODE] is None
assert state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.BRIGHTNESS]
assert state.attributes[ATTR_SUPPORTED_FEATURES] == 0
@ -177,7 +177,7 @@ async def test_switch_read_light_state_hs(hass: HomeAssistant, utcnow) -> None:
# Initial state is that the light is off
state = await helper.poll_and_get_state()
assert state.state == "off"
assert ATTR_COLOR_MODE not in state.attributes
assert state.attributes[ATTR_COLOR_MODE] is None
assert state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.HS]
assert state.attributes[ATTR_SUPPORTED_FEATURES] == 0
@ -246,7 +246,7 @@ async def test_switch_read_light_state_color_temp(hass: HomeAssistant, utcnow) -
# Initial state is that the light is off
state = await helper.poll_and_get_state()
assert state.state == "off"
assert ATTR_COLOR_MODE not in state.attributes
assert state.attributes[ATTR_COLOR_MODE] is None
assert state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.COLOR_TEMP]
assert state.attributes[ATTR_SUPPORTED_FEATURES] == 0