1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Allow toggles (switches) state to be None (#64621)

This commit is contained in:
Franck Nijhof
2022-01-23 11:31:01 +01:00
committed by GitHub
parent 01fbc4257b
commit 176f03d4ac
14 changed files with 45 additions and 32 deletions

View File

@@ -12,6 +12,7 @@ from homeassistant.const import (
SERVICE_TURN_ON,
STATE_OFF,
STATE_ON,
STATE_UNKNOWN,
)
from homeassistant.helpers import device_registry as dr
@@ -202,7 +203,7 @@ async def test_switchbox_d_init(switchbox_d, hass, config):
state = hass.states.get(entity_ids[0])
assert state.name == "switchBoxD-0.relay"
assert state.attributes[ATTR_DEVICE_CLASS] == SwitchDeviceClass.SWITCH
assert state.state == STATE_OFF # NOTE: should instead be STATE_UNKNOWN?
assert state.state == STATE_UNKNOWN
device_registry = dr.async_get(hass)
device = device_registry.async_get(entry.device_id)
@@ -219,7 +220,7 @@ async def test_switchbox_d_init(switchbox_d, hass, config):
state = hass.states.get(entity_ids[1])
assert state.name == "switchBoxD-1.relay"
assert state.attributes[ATTR_DEVICE_CLASS] == SwitchDeviceClass.SWITCH
assert state.state == STATE_OFF # NOTE: should instead be STATE_UNKNOWN?
assert state.state == STATE_UNKNOWN
device_registry = dr.async_get(hass)
device = device_registry.async_get(entry.device_id)