mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 20:55:10 +02:00
Adjust is_on
This commit is contained in:
@@ -80,10 +80,11 @@ class NotValidPresetModeError(ValueError):
|
|||||||
|
|
||||||
|
|
||||||
@bind_hass
|
@bind_hass
|
||||||
def is_on(hass: HomeAssistant, entity_id: str) -> bool:
|
def is_on(hass: HomeAssistant, entity_id: str) -> bool | None:
|
||||||
"""Return if the fans are on based on the statemachine."""
|
"""Return if the fans are on based on the statemachine."""
|
||||||
entity = hass.states.get(entity_id)
|
entity = hass.states.get(entity_id)
|
||||||
assert entity
|
if entity is None:
|
||||||
|
return None
|
||||||
return entity.state == STATE_ON
|
return entity.state == STATE_ON
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user