Przeglądaj źródła

Remove obsolete source files.

Adjust test to allow missing legacy_class for those entity types that have already been migrated to the generic classes.
Jason Rumney 4 lat temu
rodzic
commit
c94148de68

+ 0 - 74
custom_components/tuya_local/dehumidifier/light.py

@@ -1,74 +0,0 @@
-"""
-Platform to control the LED display light on Goldair WiFi-connected dehumidifiers.
-"""
-from homeassistant.components.light import LightEntity
-from homeassistant.components.climate import ATTR_HVAC_MODE, HVAC_MODE_OFF
-from homeassistant.const import STATE_UNAVAILABLE
-
-from ..device import TuyaLocalDevice
-from .const import ATTR_DISPLAY_OFF, HVAC_MODE_TO_DPS_MODE, PROPERTY_TO_DPS_ID
-
-
-class GoldairDehumidifierLedDisplayLight(LightEntity):
-    """Representation of a Goldair WiFi-connected dehumidifier LED display."""
-
-    def __init__(self, device):
-        """Initialize the light.
-        Args:
-            device (TuyaLocalDevice): The device API instance."""
-        self._device = device
-
-    @property
-    def should_poll(self):
-        """Return the polling state."""
-        return True
-
-    @property
-    def name(self):
-        """Return the name of the light."""
-        return self._device.name
-
-    @property
-    def unique_id(self):
-        """Return the unique id for this dehumidifier LED display."""
-        return self._device.unique_id
-
-    @property
-    def device_info(self):
-        """Return device information about this dehumidifier LED display."""
-        return self._device.device_info
-
-    @property
-    def icon(self):
-        """Return the icon to use in the frontend for this device."""
-        if self.is_on:
-            return "mdi:led-on"
-        else:
-            return "mdi:led-off"
-
-    @property
-    def is_on(self):
-        """Return the current state."""
-        return not (self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]))
-
-    async def async_turn_on(self):
-        await self._device.async_set_property(
-            PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF], False
-        )
-
-    async def async_turn_off(self):
-        await self._device.async_set_property(
-            PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF], True
-        )
-
-    async def async_toggle(self):
-        dps_hvac_mode = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE])
-        dps_display_off = self._device.get_property(
-            PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]
-        )
-
-        if dps_hvac_mode != HVAC_MODE_TO_DPS_MODE[HVAC_MODE_OFF]:
-            await (self.async_turn_on() if dps_display_off else self.async_turn_off())
-
-    async def async_update(self):
-        await self._device.async_refresh()

+ 0 - 70
custom_components/tuya_local/dehumidifier/lock.py

@@ -1,70 +0,0 @@
-"""
-Platform to control the child lock on Goldair WiFi-connected dehumidifiers.
-"""
-from homeassistant.components.lock import LockEntity
-from homeassistant.components.lock import STATE_LOCKED, STATE_UNLOCKED
-from homeassistant.const import STATE_UNAVAILABLE
-
-from ..device import TuyaLocalDevice
-from .const import ATTR_CHILD_LOCK, PROPERTY_TO_DPS_ID
-
-
-class GoldairDehumidifierChildLock(LockEntity):
-    """Representation of a Goldair WiFi-connected dehumidifier child lock."""
-
-    def __init__(self, device):
-        """Initialize the lock.
-        Args:
-            device (TuyaLocalDevice): The device API instance."""
-        self._device = device
-
-    @property
-    def should_poll(self):
-        """Return the polling state."""
-        return True
-
-    @property
-    def name(self):
-        """Return the name of the lock."""
-        return self._device.name
-
-    @property
-    def friendly_name(self):
-        """Return the friendly name of the lock, for the UI."""
-        return self._config.name
-
-    @property
-    def unique_id(self):
-        """Return the unique id for this dehumidifier child lock."""
-        return self._device.unique_id
-
-    @property
-    def device_info(self):
-        """Return device information about this dehumidifier child lock."""
-        return self._device.device_info
-
-    @property
-    def state(self):
-        """Return the current state."""
-        if self.is_locked is None:
-            return STATE_UNAVAILABLE
-        else:
-            return STATE_LOCKED if self.is_locked else STATE_UNLOCKED
-
-    @property
-    def is_locked(self):
-        """Return the a boolean representing whether the child lock is on or not."""
-        return self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK])
-
-    async def async_lock(self, **kwargs):
-        """Turn on the child lock."""
-        await self._device.async_set_property(PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK], True)
-
-    async def async_unlock(self, **kwargs):
-        """Turn off the child lock."""
-        await self._device.async_set_property(
-            PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK], False
-        )
-
-    async def async_update(self):
-        await self._device.async_refresh()

+ 0 - 72
custom_components/tuya_local/fan/light.py

@@ -1,72 +0,0 @@
-"""
-Platform to control the LED display light on Goldair WiFi-connected fans.
-"""
-from homeassistant.components.light import LightEntity
-from homeassistant.components.climate import ATTR_HVAC_MODE, HVAC_MODE_OFF
-from homeassistant.const import STATE_UNAVAILABLE
-
-from ..device import TuyaLocalDevice
-from .const import ATTR_DISPLAY_ON, HVAC_MODE_TO_DPS_MODE, PROPERTY_TO_DPS_ID
-
-
-class GoldairFanLedDisplayLight(LightEntity):
-    """Representation of a Goldair WiFi-connected fan LED display."""
-
-    def __init__(self, device):
-        """Initialize the light.
-        Args:
-            device (TuyaLocalDevice): The device API instance."""
-        self._device = device
-
-    @property
-    def should_poll(self):
-        """Return the polling state."""
-        return True
-
-    @property
-    def name(self):
-        """Return the name of the light."""
-        return self._device.name
-
-    @property
-    def unique_id(self):
-        """Return the unique id for this fan LED display."""
-        return self._device.unique_id
-
-    @property
-    def device_info(self):
-        """Return device information about this LED display."""
-        return self._device.device_info
-
-    @property
-    def icon(self):
-        """Return the icon to use in the frontend for this device."""
-        if self.is_on:
-            return "mdi:led-on"
-        else:
-            return "mdi:led-off"
-
-    @property
-    def is_on(self):
-        """Return the current state."""
-        return self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON])
-
-    async def async_turn_on(self):
-        await self._device.async_set_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON], True)
-
-    async def async_turn_off(self):
-        await self._device.async_set_property(
-            PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON], False
-        )
-
-    async def async_toggle(self):
-        dps_hvac_mode = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE])
-        dps_display_on = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON])
-
-        if dps_hvac_mode != HVAC_MODE_TO_DPS_MODE[HVAC_MODE_OFF]:
-            await (
-                self.async_turn_on() if not dps_display_on else self.async_turn_off()
-            )
-
-    async def async_update(self):
-        await self._device.async_refresh()

+ 0 - 65
custom_components/tuya_local/geco_heater/lock.py

@@ -1,65 +0,0 @@
-"""
-Platform to control the child lock on Goldair GECO WiFi-connected heaters and panels.
-"""
-from homeassistant.components.lock import LockEntity
-from homeassistant.components.lock import STATE_LOCKED, STATE_UNLOCKED
-from homeassistant.const import STATE_UNAVAILABLE
-
-from ..device import TuyaLocalDevice
-from .const import ATTR_CHILD_LOCK, PROPERTY_TO_DPS_ID
-
-
-class GoldairGECOHeaterChildLock(LockEntity):
-    """Representation of a Goldair GECO WiFi-connected heater child lock."""
-
-    def __init__(self, device):
-        """Initialize the lock.
-        Args:
-            device (TuyaLocalDevice): The device API instance."""
-        self._device = device
-
-    @property
-    def should_poll(self):
-        """Return the polling state."""
-        return True
-
-    @property
-    def name(self):
-        """Return the name of the lock."""
-        return self._device.name
-
-    @property
-    def unique_id(self):
-        """Return the unique id for this heater child lock."""
-        return self._device.unique_id
-
-    @property
-    def device_info(self):
-        """Return device information about this heater child lock."""
-        return self._device.device_info
-
-    @property
-    def state(self):
-        """Return the current state."""
-        if self.is_locked is None:
-            return STATE_UNAVAILABLE
-        else:
-            return STATE_LOCKED if self.is_locked else STATE_UNLOCKED
-
-    @property
-    def is_locked(self):
-        """Return the a boolean representing whether the child lock is on or not."""
-        return self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK])
-
-    async def async_lock(self, **kwargs):
-        """Turn on the child lock."""
-        await self._device.async_set_property(PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK], True)
-
-    async def async_unlock(self, **kwargs):
-        """Turn off the child lock."""
-        await self._device.async_set_property(
-            PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK], False
-        )
-
-    async def async_update(self):
-        await self._device.async_refresh()

+ 0 - 65
custom_components/tuya_local/gpcv_heater/lock.py

@@ -1,65 +0,0 @@
-"""
-Platform to control the child lock on Goldair GPCV WiFi-connected heaters and panels.
-"""
-from homeassistant.components.lock import LockEntity
-from homeassistant.components.lock import STATE_LOCKED, STATE_UNLOCKED
-from homeassistant.const import STATE_UNAVAILABLE
-
-from ..device import TuyaLocalDevice
-from .const import ATTR_CHILD_LOCK, PROPERTY_TO_DPS_ID
-
-
-class GoldairGPCVHeaterChildLock(LockEntity):
-    """Representation of a Goldair GPCV WiFi-connected heater child lock."""
-
-    def __init__(self, device):
-        """Initialize the lock.
-        Args:
-            device (TuyaLocalDevice): The device API instance."""
-        self._device = device
-
-    @property
-    def should_poll(self):
-        """Return the polling state."""
-        return True
-
-    @property
-    def name(self):
-        """Return the name of the lock."""
-        return self._device.name
-
-    @property
-    def unique_id(self):
-        """Return the unique id for this heater child lock."""
-        return self._device.unique_id
-
-    @property
-    def device_info(self):
-        """Return device information about this heater child lock."""
-        return self._device.device_info
-
-    @property
-    def state(self):
-        """Return the current state."""
-        if self.is_locked is None:
-            return STATE_UNAVAILABLE
-        else:
-            return STATE_LOCKED if self.is_locked else STATE_UNLOCKED
-
-    @property
-    def is_locked(self):
-        """Return the a boolean representing whether the child lock is on or not."""
-        return self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK])
-
-    async def async_lock(self, **kwargs):
-        """Turn on the child lock."""
-        await self._device.async_set_property(PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK], True)
-
-    async def async_unlock(self, **kwargs):
-        """Turn off the child lock."""
-        await self._device.async_set_property(
-            PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK], False
-        )
-
-    async def async_update(self):
-        await self._device.async_refresh()

+ 0 - 72
custom_components/tuya_local/heater/light.py

@@ -1,72 +0,0 @@
-"""
-Platform to control the LED display light on Goldair WiFi-connected heaters and panels.
-"""
-from homeassistant.components.light import LightEntity
-from homeassistant.components.climate import ATTR_HVAC_MODE, HVAC_MODE_OFF
-from homeassistant.const import STATE_UNAVAILABLE
-
-from ..device import TuyaLocalDevice
-from .const import ATTR_DISPLAY_ON, HVAC_MODE_TO_DPS_MODE, PROPERTY_TO_DPS_ID
-
-
-class GoldairHeaterLedDisplayLight(LightEntity):
-    """Representation of a Goldair WiFi-connected heater LED display."""
-
-    def __init__(self, device):
-        """Initialize the light.
-        Args:
-            device (TuyaLocalDevice): The device API instance."""
-        self._device = device
-
-    @property
-    def should_poll(self):
-        """Return the polling state."""
-        return True
-
-    @property
-    def name(self):
-        """Return the name of the light."""
-        return self._device.name
-
-    @property
-    def unique_id(self):
-        """Return the unique id for this heater LED display."""
-        return self._device.unique_id
-
-    @property
-    def device_info(self):
-        """Return device information about this heater LED display."""
-        return self._device.device_info
-
-    @property
-    def icon(self):
-        """Return the icon to use in the frontend for this device."""
-        if self.is_on:
-            return "mdi:led-on"
-        else:
-            return "mdi:led-off"
-
-    @property
-    def is_on(self):
-        """Return the current state."""
-        return self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON])
-
-    async def async_turn_on(self):
-        await self._device.async_set_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON], True)
-
-    async def async_turn_off(self):
-        await self._device.async_set_property(
-            PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON], False
-        )
-
-    async def async_toggle(self):
-        dps_hvac_mode = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE])
-        dps_display_on = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON])
-
-        if dps_hvac_mode != HVAC_MODE_TO_DPS_MODE[HVAC_MODE_OFF]:
-            await (
-                self.async_turn_on() if not dps_display_on else self.async_turn_off()
-            )
-
-    async def async_update(self):
-        await self._device.async_refresh()

+ 0 - 65
custom_components/tuya_local/heater/lock.py

@@ -1,65 +0,0 @@
-"""
-Platform to control the child lock on Goldair WiFi-connected heaters and panels.
-"""
-from homeassistant.components.lock import LockEntity
-from homeassistant.components.lock import STATE_LOCKED, STATE_UNLOCKED
-from homeassistant.const import STATE_UNAVAILABLE
-
-from ..device import TuyaLocalDevice
-from .const import ATTR_CHILD_LOCK, PROPERTY_TO_DPS_ID
-
-
-class GoldairHeaterChildLock(LockEntity):
-    """Representation of a Goldair WiFi-connected heater child lock."""
-
-    def __init__(self, device):
-        """Initialize the lock.
-        Args:
-            device (TuyaLocalDevice): The device API instance."""
-        self._device = device
-
-    @property
-    def should_poll(self):
-        """Return the polling state."""
-        return True
-
-    @property
-    def name(self):
-        """Return the name of the lock."""
-        return self._device.name
-
-    @property
-    def unique_id(self):
-        """Return the unique id for this heater child lock."""
-        return self._device.unique_id
-
-    @property
-    def device_info(self):
-        """Return device information about this heater child lock."""
-        return self._device.device_info
-
-    @property
-    def state(self):
-        """Return the current state."""
-        if self.is_locked is None:
-            return STATE_UNAVAILABLE
-        else:
-            return STATE_LOCKED if self.is_locked else STATE_UNLOCKED
-
-    @property
-    def is_locked(self):
-        """Return the a boolean representing whether the child lock is on or not."""
-        return self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK])
-
-    async def async_lock(self, **kwargs):
-        """Turn on the child lock."""
-        await self._device.async_set_property(PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK], True)
-
-    async def async_unlock(self, **kwargs):
-        """Turn off the child lock."""
-        await self._device.async_set_property(
-            PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK], False
-        )
-
-    async def async_update(self):
-        await self._device.async_refresh()

+ 0 - 65
custom_components/tuya_local/kogan_heater/lock.py

@@ -1,65 +0,0 @@
-"""
-Platform to control the child lock on Kogan WiFi-connected heaters and panels.
-"""
-from homeassistant.components.lock import LockEntity
-from homeassistant.components.lock import STATE_LOCKED, STATE_UNLOCKED
-from homeassistant.const import STATE_UNAVAILABLE
-
-from ..device import TuyaLocalDevice
-from .const import ATTR_CHILD_LOCK, PROPERTY_TO_DPS_ID
-
-
-class KoganHeaterChildLock(LockEntity):
-    """Representation of a Kogan WiFi-connected heater child lock."""
-
-    def __init__(self, device):
-        """Initialize the lock.
-        Args:
-            device (TuyaLocalDevice): The device API instance."""
-        self._device = device
-
-    @property
-    def should_poll(self):
-        """Return the polling state."""
-        return True
-
-    @property
-    def name(self):
-        """Return the name of the lock."""
-        return self._device.name
-
-    @property
-    def unique_id(self):
-        """Return the unique id for this heater child lock."""
-        return self._device.unique_id
-
-    @property
-    def device_info(self):
-        """Return device information about this heater child lock."""
-        return self._device.device_info
-
-    @property
-    def state(self):
-        """Return the current state."""
-        if self.is_locked is None:
-            return STATE_UNAVAILABLE
-        else:
-            return STATE_LOCKED if self.is_locked else STATE_UNLOCKED
-
-    @property
-    def is_locked(self):
-        """Return the a boolean representing whether the child lock is on or not."""
-        return self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK])
-
-    async def async_lock(self, **kwargs):
-        """Turn on the child lock."""
-        await self._device.async_set_property(PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK], True)
-
-    async def async_unlock(self, **kwargs):
-        """Turn off the child lock."""
-        await self._device.async_set_property(
-            PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK], False
-        )
-
-    async def async_update(self):
-        await self._device.async_refresh()

+ 0 - 74
custom_components/tuya_local/purline_m100_heater/light.py

@@ -1,74 +0,0 @@
-"""
-Platform to control the LED display light on Purline WiFi-connected heaters.
-"""
-from homeassistant.components.light import LightEntity
-from homeassistant.components.climate import ATTR_HVAC_MODE, HVAC_MODE_OFF
-from homeassistant.const import STATE_UNAVAILABLE
-
-from ..device import TuyaLocalDevice
-from .const import ATTR_DISPLAY_OFF, PROPERTY_TO_DPS_ID
-
-
-class PurlineM100HeaterLedDisplayLight(LightEntity):
-    """Representation of a Purline M100 WiFi-connected heater LED display."""
-
-    def __init__(self, device):
-        """Initialize the light.
-        Args:
-            device (TuyaLocalDevice): The device API instance."""
-        self._device = device
-
-    @property
-    def should_poll(self):
-        """Return the polling state."""
-        return True
-
-    @property
-    def name(self):
-        """Return the name of the light."""
-        return self._device.name
-
-    @property
-    def unique_id(self):
-        """Return the unique id for this heater LED display."""
-        return self._device.unique_id
-
-    @property
-    def device_info(self):
-        """Return device information about this heater LED display."""
-        return self._device.device_info
-
-    @property
-    def icon(self):
-        """Return the icon to use in the frontend for this device."""
-        if self.is_on:
-            return "mdi:led-on"
-        else:
-            return "mdi:led-off"
-
-    @property
-    def is_on(self):
-        """Return the current state. Note: Device state is inverted."""
-        return not (self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]))
-
-    async def async_turn_on(self):
-        await self._device.async_set_property(
-            PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF], False
-        )
-
-    async def async_turn_off(self):
-        await self._device.async_set_property(
-            PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF], True
-        )
-
-    async def async_toggle(self):
-        dps_hvac_mode = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE])
-        dps_display_off = self._device.get_property(
-            PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]
-        )
-
-        if dps_hvac_mode:
-            await (self.async_turn_on() if dps_display_off else self.async_turn_off())
-
-    async def async_update(self):
-        await self._device.async_refresh()

+ 0 - 96
tests/dehumidifier/test_light.py

@@ -1,96 +0,0 @@
-from unittest import IsolatedAsyncioTestCase
-from unittest.mock import AsyncMock, patch
-
-from custom_components.tuya_local.dehumidifier.const import (
-    ATTR_DISPLAY_OFF,
-    ATTR_HVAC_MODE,
-    PROPERTY_TO_DPS_ID,
-)
-from custom_components.tuya_local.dehumidifier.light import (
-    GoldairDehumidifierLedDisplayLight,
-)
-
-from ..const import DEHUMIDIFIER_PAYLOAD
-from ..helpers import assert_device_properties_set
-
-
-class TestGoldairDehumidifierLedDisplayLight(IsolatedAsyncioTestCase):
-    def setUp(self):
-        device_patcher = patch("custom_components.tuya_local.device.TuyaLocalDevice")
-        self.addCleanup(device_patcher.stop)
-        self.mock_device = device_patcher.start()
-
-        self.subject = GoldairDehumidifierLedDisplayLight(self.mock_device())
-
-        self.dps = DEHUMIDIFIER_PAYLOAD.copy()
-        self.subject._device.get_property.side_effect = lambda id: self.dps[id]
-
-    def test_should_poll(self):
-        self.assertTrue(self.subject.should_poll)
-
-    def test_name_returns_device_name(self):
-        self.assertEqual(self.subject.name, self.subject._device.name)
-
-    def test_unique_id_returns_device_unique_id(self):
-        self.assertEqual(self.subject.unique_id, self.subject._device.unique_id)
-
-    def test_device_info_returns_device_info_from_device(self):
-        self.assertEqual(self.subject.device_info, self.subject._device.device_info)
-
-    def test_icon(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]] = True
-        self.assertEqual(self.subject.icon, "mdi:led-off")
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]] = False
-        self.assertEqual(self.subject.icon, "mdi:led-on")
-
-    def test_is_on(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]] = True
-        self.assertEqual(self.subject.is_on, False)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]] = False
-        self.assertEqual(self.subject.is_on, True)
-
-    async def test_turn_on(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]: False}
-        ):
-            await self.subject.async_turn_on()
-
-    async def test_turn_off(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]: True}
-        ):
-            await self.subject.async_turn_off()
-
-    async def test_toggle_takes_no_action_when_dehumidifier_off(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE]] = False
-        await self.subject.async_toggle()
-        self.subject._device.async_set_property.assert_not_called
-
-    async def test_toggle_turns_the_light_on_when_it_was_off(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE]] = True
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]] = True
-
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]: False}
-        ):
-            await self.subject.async_toggle()
-
-    async def test_toggle_turns_the_light_off_when_it_was_on(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE]] = True
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]] = False
-
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]: True}
-        ):
-            await self.subject.async_toggle()
-
-    async def test_update(self):
-        result = AsyncMock()
-        self.subject._device.async_refresh.return_value = result()
-
-        await self.subject.async_update()
-
-        self.subject._device.async_refresh.assert_called_once()
-        result.assert_awaited()

+ 0 - 77
tests/dehumidifier/test_lock.py

@@ -1,77 +0,0 @@
-from unittest import IsolatedAsyncioTestCase
-from unittest.mock import AsyncMock, patch
-
-from homeassistant.components.lock import STATE_LOCKED, STATE_UNLOCKED
-from homeassistant.const import STATE_UNAVAILABLE
-
-from custom_components.tuya_local.dehumidifier.const import (
-    ATTR_CHILD_LOCK,
-    ATTR_HVAC_MODE,
-    PROPERTY_TO_DPS_ID,
-)
-from custom_components.tuya_local.dehumidifier.lock import GoldairDehumidifierChildLock
-
-from ..const import DEHUMIDIFIER_PAYLOAD
-from ..helpers import assert_device_properties_set
-
-
-class TestGoldairDehumidifierChildLock(IsolatedAsyncioTestCase):
-    def setUp(self):
-        device_patcher = patch("custom_components.tuya_local.device.TuyaLocalDevice")
-        self.addCleanup(device_patcher.stop)
-        self.mock_device = device_patcher.start()
-
-        self.subject = GoldairDehumidifierChildLock(self.mock_device())
-
-        self.dps = DEHUMIDIFIER_PAYLOAD.copy()
-        self.subject._device.get_property.side_effect = lambda id: self.dps[id]
-
-    def test_should_poll(self):
-        self.assertTrue(self.subject.should_poll)
-
-    def test_name_returns_device_name(self):
-        self.assertEqual(self.subject.name, self.subject._device.name)
-
-    def test_unique_id_returns_device_unique_id(self):
-        self.assertEqual(self.subject.unique_id, self.subject._device.unique_id)
-
-    def test_device_info_returns_device_info_from_device(self):
-        self.assertEqual(self.subject.device_info, self.subject._device.device_info)
-
-    def test_state(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = True
-        self.assertEqual(self.subject.state, STATE_LOCKED)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = False
-        self.assertEqual(self.subject.state, STATE_UNLOCKED)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = None
-        self.assertEqual(self.subject.state, STATE_UNAVAILABLE)
-
-    def test_is_locked(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = True
-        self.assertEqual(self.subject.is_locked, True)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = False
-        self.assertEqual(self.subject.is_locked, False)
-
-    async def test_lock(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]: True}
-        ):
-            await self.subject.async_lock()
-
-    async def test_unlock(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]: False}
-        ):
-            await self.subject.async_unlock()
-
-    async def test_update(self):
-        result = AsyncMock()
-        self.subject._device.async_refresh.return_value = result()
-
-        await self.subject.async_update()
-
-        self.subject._device.async_refresh.assert_called_once()
-        result.assert_awaited()

+ 0 - 94
tests/fan/test_light.py

@@ -1,94 +0,0 @@
-from unittest import IsolatedAsyncioTestCase
-from unittest.mock import AsyncMock, patch
-
-from custom_components.tuya_local.fan.const import (
-    ATTR_DISPLAY_ON,
-    ATTR_HVAC_MODE,
-    PROPERTY_TO_DPS_ID,
-)
-from custom_components.tuya_local.fan.light import GoldairFanLedDisplayLight
-
-from ..const import FAN_PAYLOAD
-from ..helpers import assert_device_properties_set
-
-
-class TestGoldairFanLedDisplayLight(IsolatedAsyncioTestCase):
-    def setUp(self):
-        device_patcher = patch("custom_components.tuya_local.device.TuyaLocalDevice")
-        self.addCleanup(device_patcher.stop)
-        self.mock_device = device_patcher.start()
-
-        self.subject = GoldairFanLedDisplayLight(self.mock_device())
-
-        self.dps = FAN_PAYLOAD.copy()
-        self.subject._device.get_property.side_effect = lambda id: self.dps[id]
-
-    def test_should_poll(self):
-        self.assertTrue(self.subject.should_poll)
-
-    def test_name_returns_device_name(self):
-        self.assertEqual(self.subject.name, self.subject._device.name)
-
-    def test_unique_id_returns_device_unique_id(self):
-        self.assertEqual(self.subject.unique_id, self.subject._device.unique_id)
-
-    def test_device_info_returns_device_info_from_device(self):
-        self.assertEqual(self.subject.device_info, self.subject._device.device_info)
-
-    def test_icon(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]] = True
-        self.assertEqual(self.subject.icon, "mdi:led-on")
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]] = False
-        self.assertEqual(self.subject.icon, "mdi:led-off")
-
-    def test_is_on(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]] = True
-        self.assertEqual(self.subject.is_on, True)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]] = False
-        self.assertEqual(self.subject.is_on, False)
-
-    async def test_turn_on(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]: True}
-        ):
-            await self.subject.async_turn_on()
-
-    async def test_turn_off(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]: False}
-        ):
-            await self.subject.async_turn_off()
-
-    async def test_toggle_takes_no_action_when_fan_off(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE]] = False
-        await self.subject.async_toggle()
-        self.subject._device.async_set_property.assert_not_called
-
-    async def test_toggle_turns_the_light_on_when_it_was_off(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE]] = True
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]] = False
-
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]: True}
-        ):
-            await self.subject.async_toggle()
-
-    async def test_toggle_turns_the_light_off_when_it_was_on(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE]] = True
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]] = True
-
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]: False}
-        ):
-            await self.subject.async_toggle()
-
-    async def test_update(self):
-        result = AsyncMock()
-        self.subject._device.async_refresh.return_value = result()
-
-        await self.subject.async_update()
-
-        self.subject._device.async_refresh.assert_called_once()
-        result.assert_awaited()

+ 0 - 77
tests/geco_heater/test_lock.py

@@ -1,77 +0,0 @@
-from unittest import IsolatedAsyncioTestCase
-from unittest.mock import AsyncMock, patch
-
-from homeassistant.components.lock import STATE_LOCKED, STATE_UNLOCKED
-from homeassistant.const import STATE_UNAVAILABLE
-
-from custom_components.tuya_local.geco_heater.const import (
-    ATTR_CHILD_LOCK,
-    ATTR_HVAC_MODE,
-    PROPERTY_TO_DPS_ID,
-)
-from custom_components.tuya_local.geco_heater.lock import GoldairGECOHeaterChildLock
-
-from ..const import GECO_HEATER_PAYLOAD
-from ..helpers import assert_device_properties_set
-
-
-class TestGoldairGECOHeaterChildLock(IsolatedAsyncioTestCase):
-    def setUp(self):
-        device_patcher = patch("custom_components.tuya_local.device.TuyaLocalDevice")
-        self.addCleanup(device_patcher.stop)
-        self.mock_device = device_patcher.start()
-
-        self.subject = GoldairGECOHeaterChildLock(self.mock_device())
-
-        self.dps = GECO_HEATER_PAYLOAD.copy()
-        self.subject._device.get_property.side_effect = lambda id: self.dps[id]
-
-    def test_should_poll(self):
-        self.assertTrue(self.subject.should_poll)
-
-    def test_name_returns_device_name(self):
-        self.assertEqual(self.subject.name, self.subject._device.name)
-
-    def test_unique_id_returns_device_unique_id(self):
-        self.assertEqual(self.subject.unique_id, self.subject._device.unique_id)
-
-    def test_device_info_returns_device_info_from_device(self):
-        self.assertEqual(self.subject.device_info, self.subject._device.device_info)
-
-    def test_state(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = True
-        self.assertEqual(self.subject.state, STATE_LOCKED)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = False
-        self.assertEqual(self.subject.state, STATE_UNLOCKED)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = None
-        self.assertEqual(self.subject.state, STATE_UNAVAILABLE)
-
-    def test_is_locked(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = True
-        self.assertEqual(self.subject.is_locked, True)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = False
-        self.assertEqual(self.subject.is_locked, False)
-
-    async def test_lock(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]: True}
-        ):
-            await self.subject.async_lock()
-
-    async def test_unlock(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]: False}
-        ):
-            await self.subject.async_unlock()
-
-    async def test_update(self):
-        result = AsyncMock()
-        self.subject._device.async_refresh.return_value = result()
-
-        await self.subject.async_update()
-
-        self.subject._device.async_refresh.assert_called_once()
-        result.assert_awaited()

+ 0 - 77
tests/gpcv_heater/test_lock.py

@@ -1,77 +0,0 @@
-from unittest import IsolatedAsyncioTestCase
-from unittest.mock import AsyncMock, patch
-
-from homeassistant.components.lock import STATE_LOCKED, STATE_UNLOCKED
-from homeassistant.const import STATE_UNAVAILABLE
-
-from custom_components.tuya_local.gpcv_heater.const import (
-    ATTR_CHILD_LOCK,
-    ATTR_HVAC_MODE,
-    PROPERTY_TO_DPS_ID,
-)
-from custom_components.tuya_local.gpcv_heater.lock import GoldairGPCVHeaterChildLock
-
-from ..const import GPCV_HEATER_PAYLOAD
-from ..helpers import assert_device_properties_set
-
-
-class TestGoldairGPCVHeaterChildLock(IsolatedAsyncioTestCase):
-    def setUp(self):
-        device_patcher = patch("custom_components.tuya_local.device.TuyaLocalDevice")
-        self.addCleanup(device_patcher.stop)
-        self.mock_device = device_patcher.start()
-
-        self.subject = GoldairGPCVHeaterChildLock(self.mock_device())
-
-        self.dps = GPCV_HEATER_PAYLOAD.copy()
-        self.subject._device.get_property.side_effect = lambda id: self.dps[id]
-
-    def test_should_poll(self):
-        self.assertTrue(self.subject.should_poll)
-
-    def test_name_returns_device_name(self):
-        self.assertEqual(self.subject.name, self.subject._device.name)
-
-    def test_unique_id_returns_device_unique_id(self):
-        self.assertEqual(self.subject.unique_id, self.subject._device.unique_id)
-
-    def test_device_info_returns_device_info_from_device(self):
-        self.assertEqual(self.subject.device_info, self.subject._device.device_info)
-
-    def test_state(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = True
-        self.assertEqual(self.subject.state, STATE_LOCKED)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = False
-        self.assertEqual(self.subject.state, STATE_UNLOCKED)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = None
-        self.assertEqual(self.subject.state, STATE_UNAVAILABLE)
-
-    def test_is_locked(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = True
-        self.assertEqual(self.subject.is_locked, True)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = False
-        self.assertEqual(self.subject.is_locked, False)
-
-    async def test_lock(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]: True}
-        ):
-            await self.subject.async_lock()
-
-    async def test_unlock(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]: False}
-        ):
-            await self.subject.async_unlock()
-
-    async def test_update(self):
-        result = AsyncMock()
-        self.subject._device.async_refresh.return_value = result()
-
-        await self.subject.async_update()
-
-        self.subject._device.async_refresh.assert_called_once()
-        result.assert_awaited()

+ 0 - 94
tests/heater/test_light.py

@@ -1,94 +0,0 @@
-from unittest import IsolatedAsyncioTestCase
-from unittest.mock import AsyncMock, patch
-
-from custom_components.tuya_local.heater.const import (
-    ATTR_DISPLAY_ON,
-    ATTR_HVAC_MODE,
-    PROPERTY_TO_DPS_ID,
-)
-from custom_components.tuya_local.heater.light import GoldairHeaterLedDisplayLight
-
-from ..const import GPPH_HEATER_PAYLOAD
-from ..helpers import assert_device_properties_set
-
-
-class TestGoldairHeaterLedDisplayLight(IsolatedAsyncioTestCase):
-    def setUp(self):
-        device_patcher = patch("custom_components.tuya_local.device.TuyaLocalDevice")
-        self.addCleanup(device_patcher.stop)
-        self.mock_device = device_patcher.start()
-
-        self.subject = GoldairHeaterLedDisplayLight(self.mock_device())
-
-        self.dps = GPPH_HEATER_PAYLOAD.copy()
-        self.subject._device.get_property.side_effect = lambda id: self.dps[id]
-
-    def test_should_poll(self):
-        self.assertTrue(self.subject.should_poll)
-
-    def test_name_returns_device_name(self):
-        self.assertEqual(self.subject.name, self.subject._device.name)
-
-    def test_unique_id_returns_device_unique_id(self):
-        self.assertEqual(self.subject.unique_id, self.subject._device.unique_id)
-
-    def test_device_info_returns_device_info_from_device(self):
-        self.assertEqual(self.subject.device_info, self.subject._device.device_info)
-
-    def test_icon(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]] = True
-        self.assertEqual(self.subject.icon, "mdi:led-on")
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]] = False
-        self.assertEqual(self.subject.icon, "mdi:led-off")
-
-    def test_is_on(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]] = True
-        self.assertEqual(self.subject.is_on, True)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]] = False
-        self.assertEqual(self.subject.is_on, False)
-
-    async def test_turn_on(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]: True}
-        ):
-            await self.subject.async_turn_on()
-
-    async def test_turn_off(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]: False}
-        ):
-            await self.subject.async_turn_off()
-
-    async def test_toggle_takes_no_action_when_heater_off(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE]] = False
-        await self.subject.async_toggle()
-        self.subject._device.async_set_property.assert_not_called
-
-    async def test_toggle_turns_the_light_on_when_it_was_off(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE]] = True
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]] = False
-
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]: True}
-        ):
-            await self.subject.async_toggle()
-
-    async def test_toggle_turns_the_light_off_when_it_was_on(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE]] = True
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]] = True
-
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON]: False}
-        ):
-            await self.subject.async_toggle()
-
-    async def test_update(self):
-        result = AsyncMock()
-        self.subject._device.async_refresh.return_value = result()
-
-        await self.subject.async_update()
-
-        self.subject._device.async_refresh.assert_called_once()
-        result.assert_awaited()

+ 0 - 77
tests/heater/test_lock.py

@@ -1,77 +0,0 @@
-from unittest import IsolatedAsyncioTestCase
-from unittest.mock import AsyncMock, patch
-
-from homeassistant.components.lock import STATE_LOCKED, STATE_UNLOCKED
-from homeassistant.const import STATE_UNAVAILABLE
-
-from custom_components.tuya_local.heater.const import (
-    ATTR_CHILD_LOCK,
-    ATTR_HVAC_MODE,
-    PROPERTY_TO_DPS_ID,
-)
-from custom_components.tuya_local.heater.lock import GoldairHeaterChildLock
-
-from ..const import GPPH_HEATER_PAYLOAD
-from ..helpers import assert_device_properties_set
-
-
-class TestGoldairHeaterChildLock(IsolatedAsyncioTestCase):
-    def setUp(self):
-        device_patcher = patch("custom_components.tuya_local.device.TuyaLocalDevice")
-        self.addCleanup(device_patcher.stop)
-        self.mock_device = device_patcher.start()
-
-        self.subject = GoldairHeaterChildLock(self.mock_device())
-
-        self.dps = GPPH_HEATER_PAYLOAD.copy()
-        self.subject._device.get_property.side_effect = lambda id: self.dps[id]
-
-    def test_should_poll(self):
-        self.assertTrue(self.subject.should_poll)
-
-    def test_name_returns_device_name(self):
-        self.assertEqual(self.subject.name, self.subject._device.name)
-
-    def test_unique_id_returns_device_unique_id(self):
-        self.assertEqual(self.subject.unique_id, self.subject._device.unique_id)
-
-    def test_device_info_returns_device_info_from_device(self):
-        self.assertEqual(self.subject.device_info, self.subject._device.device_info)
-
-    def test_state(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = True
-        self.assertEqual(self.subject.state, STATE_LOCKED)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = False
-        self.assertEqual(self.subject.state, STATE_UNLOCKED)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = None
-        self.assertEqual(self.subject.state, STATE_UNAVAILABLE)
-
-    def test_is_locked(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = True
-        self.assertEqual(self.subject.is_locked, True)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = False
-        self.assertEqual(self.subject.is_locked, False)
-
-    async def test_lock(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]: True}
-        ):
-            await self.subject.async_lock()
-
-    async def test_unlock(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]: False}
-        ):
-            await self.subject.async_unlock()
-
-    async def test_update(self):
-        result = AsyncMock()
-        self.subject._device.async_refresh.return_value = result()
-
-        await self.subject.async_update()
-
-        self.subject._device.async_refresh.assert_called_once()
-        result.assert_awaited()

+ 0 - 77
tests/kogan_heater/test_lock.py

@@ -1,77 +0,0 @@
-from unittest import IsolatedAsyncioTestCase
-from unittest.mock import AsyncMock, patch
-
-from homeassistant.components.lock import STATE_LOCKED, STATE_UNLOCKED
-from homeassistant.const import STATE_UNAVAILABLE
-
-from custom_components.tuya_local.kogan_heater.const import (
-    ATTR_CHILD_LOCK,
-    ATTR_HVAC_MODE,
-    PROPERTY_TO_DPS_ID,
-)
-from custom_components.tuya_local.kogan_heater.lock import KoganHeaterChildLock
-
-from ..const import KOGAN_HEATER_PAYLOAD
-from ..helpers import assert_device_properties_set
-
-
-class TestKoganHeaterChildLock(IsolatedAsyncioTestCase):
-    def setUp(self):
-        device_patcher = patch("custom_components.tuya_local.device.TuyaLocalDevice")
-        self.addCleanup(device_patcher.stop)
-        self.mock_device = device_patcher.start()
-
-        self.subject = KoganHeaterChildLock(self.mock_device())
-
-        self.dps = KOGAN_HEATER_PAYLOAD.copy()
-        self.subject._device.get_property.side_effect = lambda id: self.dps[id]
-
-    def test_should_poll(self):
-        self.assertTrue(self.subject.should_poll)
-
-    def test_name_returns_device_name(self):
-        self.assertEqual(self.subject.name, self.subject._device.name)
-
-    def test_unique_id_returns_device_unique_id(self):
-        self.assertEqual(self.subject.unique_id, self.subject._device.unique_id)
-
-    def test_device_info_returns_device_info_from_device(self):
-        self.assertEqual(self.subject.device_info, self.subject._device.device_info)
-
-    def test_state(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = True
-        self.assertEqual(self.subject.state, STATE_LOCKED)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = False
-        self.assertEqual(self.subject.state, STATE_UNLOCKED)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = None
-        self.assertEqual(self.subject.state, STATE_UNAVAILABLE)
-
-    def test_is_locked(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = True
-        self.assertEqual(self.subject.is_locked, True)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]] = False
-        self.assertEqual(self.subject.is_locked, False)
-
-    async def test_lock(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]: True}
-        ):
-            await self.subject.async_lock()
-
-    async def test_unlock(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_CHILD_LOCK]: False}
-        ):
-            await self.subject.async_unlock()
-
-    async def test_update(self):
-        result = AsyncMock()
-        self.subject._device.async_refresh.return_value = result()
-
-        await self.subject.async_update()
-
-        self.subject._device.async_refresh.assert_called_once()
-        result.assert_awaited()

+ 0 - 96
tests/purline_m100_heater/test_light.py

@@ -1,96 +0,0 @@
-from unittest import IsolatedAsyncioTestCase
-from unittest.mock import AsyncMock, patch
-
-from custom_components.tuya_local.purline_m100_heater.const import (
-    ATTR_DISPLAY_OFF,
-    ATTR_HVAC_MODE,
-    PROPERTY_TO_DPS_ID,
-)
-from custom_components.tuya_local.purline_m100_heater.light import (
-    PurlineM100HeaterLedDisplayLight,
-)
-
-from ..const import PURLINE_M100_HEATER_PAYLOAD
-from ..helpers import assert_device_properties_set
-
-
-class TestPurlineM100HeaterLedDisplayLight(IsolatedAsyncioTestCase):
-    def setUp(self):
-        device_patcher = patch("custom_components.tuya_local.device.TuyaLocalDevice")
-        self.addCleanup(device_patcher.stop)
-        self.mock_device = device_patcher.start()
-
-        self.subject = PurlineM100HeaterLedDisplayLight(self.mock_device())
-
-        self.dps = PURLINE_M100_HEATER_PAYLOAD.copy()
-        self.subject._device.get_property.side_effect = lambda id: self.dps[id]
-
-    def test_should_poll(self):
-        self.assertTrue(self.subject.should_poll)
-
-    def test_name_returns_device_name(self):
-        self.assertEqual(self.subject.name, self.subject._device.name)
-
-    def test_unique_id_returns_device_unique_id(self):
-        self.assertEqual(self.subject.unique_id, self.subject._device.unique_id)
-
-    def test_device_info_returns_device_info_from_device(self):
-        self.assertEqual(self.subject.device_info, self.subject._device.device_info)
-
-    def test_icon(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]] = False
-        self.assertEqual(self.subject.icon, "mdi:led-on")
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]] = True
-        self.assertEqual(self.subject.icon, "mdi:led-off")
-
-    def test_is_on(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]] = False
-        self.assertEqual(self.subject.is_on, True)
-
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]] = True
-        self.assertEqual(self.subject.is_on, False)
-
-    async def test_turn_on(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]: False}
-        ):
-            await self.subject.async_turn_on()
-
-    async def test_turn_off(self):
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]: True}
-        ):
-            await self.subject.async_turn_off()
-
-    async def test_toggle_takes_no_action_when_heater_off(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE]] = False
-        await self.subject.async_toggle()
-        self.subject._device.async_set_property.assert_not_called
-
-    async def test_toggle_turns_the_light_on_when_it_was_off(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE]] = True
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]] = True
-
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]: False}
-        ):
-            await self.subject.async_toggle()
-
-    async def test_toggle_turns_the_light_off_when_it_was_on(self):
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE]] = True
-        self.dps[PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]] = False
-
-        async with assert_device_properties_set(
-            self.subject._device, {PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF]: True}
-        ):
-            await self.subject.async_toggle()
-
-    async def test_update(self):
-        result = AsyncMock()
-        self.subject._device.async_refresh.return_value = result()
-
-        await self.subject.async_update()
-
-        self.subject._device.async_refresh.assert_called_once()
-        result.assert_awaited()

+ 6 - 3
tests/test_device_config.py

@@ -72,9 +72,12 @@ class TestDeviceConfig(unittest.TestCase):
                 f"No class for {parsed.legacy_type}/primary entity",
             )
             for e in parsed.secondary_entities():
-                self.assertIsNotNone(
-                    e.legacy_class, f"No class for {parsed.legacy_type}/{e.name}"
-                )
+                # Exception for entity types that were already moved to the new
+                # generic classes
+                if e.entity != "lock" and e.entity != "light":
+                    self.assertIsNotNone(
+                        e.legacy_class, f"No class for {parsed.legacy_type}/{e.name}"
+                    )
 
     def _test_detect(self, payload, legacy_type, legacy_class):
         """Test that payload is detected as the correct type and class."""