Use shorthand attributes in orvibo switch (#163508)

This commit is contained in:
epenet
2026-02-19 14:46:07 +01:00
committed by GitHub
parent 21cf5dc321
commit 9de89b923e
+3 -13
View File
@@ -83,25 +83,15 @@ class S20Switch(SwitchEntity):
def __init__(self, name, s20):
"""Initialize the S20 device."""
self._name = name
self._attr_name = name
self._s20 = s20
self._state = False
self._attr_is_on = False
self._exc = S20Exception
@property
def name(self):
"""Return the name of the switch."""
return self._name
@property
def is_on(self):
"""Return true if device is on."""
return self._state
def update(self) -> None:
"""Update device state."""
try:
self._state = self._s20.on
self._attr_is_on = self._s20.on
except self._exc:
_LOGGER.exception("Error while fetching S20 state")