Sfoglia il codice sorgente

cleanup(entities): remove remnants of failed (dead)locking

Previous change introduced locking to ensure previous changes
were taken into account when modifying multiple entities on
the same device in a scene. But this caused deadlocks, so had
to be reverted.

Remove the *_locked functions that were introduced to make this
change cleanly, as they are misleading now that they are called
without locking.
Jason Rumney 6 giorni fa
parent
commit
84b9bee0cf

+ 0 - 3
custom_components/tuya_local/datetime.py

@@ -103,9 +103,6 @@ class TuyaLocalDateTime(TuyaLocalEntity, DateTimeEntity):
 
     async def async_set_value(self, value: datetime):
         """Set the datetime."""
-        return await self._async_set_value_locked(value)
-
-    async def _async_set_value_locked(self, value: datetime):
         settings = {}
         # Use Local time if split into components
         if self._year_dps:

+ 0 - 3
custom_components/tuya_local/light.py

@@ -564,9 +564,6 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
             await self._device.async_set_properties(settings)
 
     async def async_turn_off(self):
-        await self._async_turn_off_locked()
-
-    async def _async_turn_off_locked(self):
         if self._switch_dps and not self._switch_dps.readonly:
             _LOGGER.info("%s turning light off", self._config.config_id)
             await self._switch_dps.async_set_value(self._device, False)

+ 0 - 3
custom_components/tuya_local/siren.py

@@ -79,9 +79,6 @@ class TuyaLocalSiren(TuyaLocalEntity, SirenEntity):
             return self._tone_dp.get_value(self._device) != "off"
 
     async def async_turn_on(self, **kwargs) -> None:
-        await self._async_turn_on_locked(**kwargs)
-
-    async def _async_turn_on_locked(self, **kwargs) -> None:
         tone = kwargs.get(ATTR_TONE, None)
         duration = kwargs.get(ATTR_DURATION, None)
         volume = kwargs.get(ATTR_VOLUME_LEVEL, None)

+ 0 - 3
custom_components/tuya_local/time.py

@@ -99,9 +99,6 @@ class TuyaLocalTime(TuyaLocalEntity, TimeEntity):
 
     async def async_set_value(self, value: time):
         """Set the number."""
-        return await self._async_set_value_locked(value)
-
-    async def _async_set_value_locked(self, value: time):
         settings = {}
         hours = value.hour
         minutes = value.minute