Skip to content

Commit 3e12bbf

Browse files
authored
Merge pull request BenPru#467 from BenPru/main
Fix binary sensors and switches showing Unknown iso Off
2 parents fb715d8 + 2146c71 commit 3e12bbf

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

custom_components/luxtronik/base.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,16 @@ def _handle_coordinator_update(self, force: bool = False) -> None:
186186

187187
def compute_is_on(self, state: Any) -> bool:
188188
descr = self.entity_description
189+
189190
if isinstance(descr.on_state, bool) and state is not None:
190191
state = bool(state)
191-
return (
192-
state != descr.on_state
193-
if descr.inverted
194-
else state == descr.on_state
195-
or (descr.on_states and state in descr.on_states)
192+
193+
is_on = bool(
194+
state == descr.on_state or (descr.on_states and state in descr.on_states)
196195
)
197196

197+
return not is_on if descr.inverted else is_on
198+
198199
def _enrich_extra_attributes(self) -> None:
199200
for attr in self.entity_description.extra_attributes:
200201
if attr.format is None and (

0 commit comments

Comments
 (0)