mirror of
https://github.com/home-assistant/core.git
synced 2025-08-01 03:35:09 +02:00
Return 'None' for light attributes when off instead of removing them (#101946)
This commit is contained in:
@@ -351,7 +351,7 @@ async def test_controlling_state_via_mqtt_on_off(
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_OFF
|
||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||
assert "color_mode" not in state.attributes
|
||||
assert not state.attributes["color_mode"]
|
||||
|
||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"ON"}')
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
@@ -361,7 +361,7 @@ async def test_controlling_state_via_mqtt_on_off(
|
||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"OFF"}')
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_OFF
|
||||
assert "color_mode" not in state.attributes
|
||||
assert not state.attributes["color_mode"]
|
||||
|
||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/stat/RESULT", '{"POWER":"ON"}')
|
||||
|
||||
@@ -373,7 +373,7 @@ async def test_controlling_state_via_mqtt_on_off(
|
||||
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_OFF
|
||||
assert "color_mode" not in state.attributes
|
||||
assert not state.attributes["color_mode"]
|
||||
|
||||
|
||||
async def test_controlling_state_via_mqtt_ct(
|
||||
@@ -402,7 +402,7 @@ async def test_controlling_state_via_mqtt_ct(
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_OFF
|
||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||
assert "color_mode" not in state.attributes
|
||||
assert not state.attributes["color_mode"]
|
||||
|
||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"ON"}')
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
@@ -412,7 +412,7 @@ async def test_controlling_state_via_mqtt_ct(
|
||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"OFF"}')
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_OFF
|
||||
assert "color_mode" not in state.attributes
|
||||
assert not state.attributes["color_mode"]
|
||||
|
||||
async_fire_mqtt_message(
|
||||
hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"ON","Dimmer":50}'
|
||||
@@ -467,7 +467,7 @@ async def test_controlling_state_via_mqtt_rgbw(
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_OFF
|
||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||
assert "color_mode" not in state.attributes
|
||||
assert not state.attributes["color_mode"]
|
||||
|
||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"ON"}')
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
@@ -477,7 +477,7 @@ async def test_controlling_state_via_mqtt_rgbw(
|
||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"OFF"}')
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_OFF
|
||||
assert "color_mode" not in state.attributes
|
||||
assert not state.attributes["color_mode"]
|
||||
|
||||
async_fire_mqtt_message(
|
||||
hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"ON","Dimmer":50,"White":0}'
|
||||
@@ -568,7 +568,7 @@ async def test_controlling_state_via_mqtt_rgbww(
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_OFF
|
||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||
assert "color_mode" not in state.attributes
|
||||
assert not state.attributes["color_mode"]
|
||||
|
||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"ON"}')
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
@@ -578,7 +578,7 @@ async def test_controlling_state_via_mqtt_rgbww(
|
||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"OFF"}')
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_OFF
|
||||
assert "color_mode" not in state.attributes
|
||||
assert not state.attributes["color_mode"]
|
||||
|
||||
async_fire_mqtt_message(
|
||||
hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"ON","Dimmer":50}'
|
||||
@@ -604,7 +604,7 @@ async def test_controlling_state_via_mqtt_rgbww(
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_ON
|
||||
# Setting white > 0 should clear the color
|
||||
assert "rgb_color" not in state.attributes
|
||||
assert not state.attributes.get("hs_color")
|
||||
assert state.attributes.get("color_mode") == "color_temp"
|
||||
|
||||
async_fire_mqtt_message(
|
||||
@@ -621,7 +621,7 @@ async def test_controlling_state_via_mqtt_rgbww(
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_ON
|
||||
# Setting white to 0 should clear the color_temp
|
||||
assert "color_temp" not in state.attributes
|
||||
assert not state.attributes.get("color_temp")
|
||||
assert state.attributes.get("hs_color") == (30, 100)
|
||||
assert state.attributes.get("color_mode") == "hs"
|
||||
|
||||
@@ -670,7 +670,7 @@ async def test_controlling_state_via_mqtt_rgbww_tuya(
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_OFF
|
||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||
assert "color_mode" not in state.attributes
|
||||
assert not state.attributes["color_mode"]
|
||||
|
||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"ON"}')
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
@@ -680,7 +680,7 @@ async def test_controlling_state_via_mqtt_rgbww_tuya(
|
||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"OFF"}')
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_OFF
|
||||
assert "color_mode" not in state.attributes
|
||||
assert not state.attributes["color_mode"]
|
||||
|
||||
async_fire_mqtt_message(
|
||||
hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"ON","Dimmer":50}'
|
||||
@@ -716,7 +716,7 @@ async def test_controlling_state_via_mqtt_rgbww_tuya(
|
||||
state = hass.states.get("light.tasmota_test")
|
||||
assert state.state == STATE_ON
|
||||
# Setting white > 0 should clear the color
|
||||
assert "rgb_color" not in state.attributes
|
||||
assert not state.attributes.get("hs_color")
|
||||
assert state.attributes.get("color_mode") == "color_temp"
|
||||
|
||||
async_fire_mqtt_message(
|
||||
|
Reference in New Issue
Block a user