From 48d207f250f99d8126702342c05a6be6e877e4d5 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 22 Jun 2022 09:52:34 +0000 Subject: [PATCH] Adjust is_on --- homeassistant/components/fan/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/fan/__init__.py b/homeassistant/components/fan/__init__.py index 55732041131..32baa5099c5 100644 --- a/homeassistant/components/fan/__init__.py +++ b/homeassistant/components/fan/__init__.py @@ -80,10 +80,11 @@ class NotValidPresetModeError(ValueError): @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.""" entity = hass.states.get(entity_id) - assert entity + if entity is None: + return None return entity.state == STATE_ON