Skip to content

Commit 394a2a8

Browse files
committed
Fix binary sensors and switches showing Unknown iso Off
1 parent 11685a3 commit 394a2a8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

custom_components/luxtronik/base.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,18 @@ def _handle_coordinator_update(self, force: bool = False) -> None:
188188

189189
def compute_is_on(self, state: Any) -> bool:
190190
descr = self.entity_description
191+
191192
if isinstance(descr.on_state, bool) and state is not None:
192193
state = bool(state)
193-
return (
194-
state != descr.on_state
195-
if descr.inverted
196-
else state == descr.on_state
194+
195+
is_on = bool(
196+
state == descr.on_state
197197
or (descr.on_states and state in descr.on_states)
198198
)
199199

200+
return not is_on if descr.inverted else is_on
201+
202+
200203
def _enrich_extra_attributes(self) -> None:
201204
for attr in self.entity_description.extra_attributes:
202205
if attr.format is None and (

0 commit comments

Comments
 (0)