Simplify is_on state for switch groups (#68805)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
This commit is contained in:
Franck Nijhof 2022-03-29 07:09:42 +02:00 committed by GitHub
parent 69fcce3b2c
commit 085b44e45a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,6 +168,6 @@ class SwitchGroup(GroupEntity, SwitchEntity):
self._attr_is_on = None
else:
# Set as ON if any / all member is ON
self._attr_is_on = self.mode(list(map(lambda x: x == STATE_ON, states)))
self._attr_is_on = self.mode(state == STATE_ON for state in states)
self._attr_available = any(state != STATE_UNAVAILABLE for state in states)