async states

This commit is contained in:
Devmel Apps
2023-08-04 16:41:19 +02:00
parent bb072fd573
commit 055cf05b48
7 changed files with 51 additions and 35 deletions
+2 -2
View File
@@ -77,13 +77,13 @@ class AirSendSwitch(SwitchEntity):
def turn_on(self, **kwargs: Any) -> None:
"""Turn the device on."""
note = {"method": 1, "type": 0, "value": "ON"}
if self._device.transfer(note):
if self._device.transfer(note, self.entity_id) == True:
self._state = True
self.schedule_update_ha_state()
def turn_off(self, **kwargs: Any) -> None:
"""Turn the device off."""
note = {"method": 1, "type": 0, "value": "OFF"}
if self._device.transfer(note):
if self._device.transfer(note, self.entity_id) == True:
self._state = False
self.schedule_update_ha_state()