Skip to content

Commit

Permalink
fix: async switch
Browse files Browse the repository at this point in the history
  • Loading branch information
pilotak committed Dec 21, 2024
1 parent 23cb9fc commit c1daa17
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions custom_components/mcp2221/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async def async_added_to_hass(self) -> None:
def is_on(self):
return self._state

async def turn_on(self, **kwargs):
async def async_turn_on(self, **kwargs):
LOGGER.info("Turn on GP%i", self._pin)
try:
async with self._lock:
Expand All @@ -104,7 +104,9 @@ async def turn_on(self, **kwargs):
LOGGER.error("Device not available")
self._state = None

async def turn_off(self, **kwargs):
self.async_write_ha_state()

async def async_turn_off(self, **kwargs):
LOGGER.info("Turn off GP%i", self._pin)
try:
async with self._lock:
Expand All @@ -113,3 +115,5 @@ async def turn_off(self, **kwargs):
except OSError:
LOGGER.error("Device not available")
self._state = None

self.async_write_ha_state()

0 comments on commit c1daa17

Please sign in to comment.