From 8785a9869e37a6b5727bdae025a1c4a509ec7685 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:04:01 +0200 Subject: [PATCH] Rename tuya base entity module (#126180) --- homeassistant/components/tuya/alarm_control_panel.py | 2 +- homeassistant/components/tuya/binary_sensor.py | 2 +- homeassistant/components/tuya/button.py | 2 +- homeassistant/components/tuya/camera.py | 2 +- homeassistant/components/tuya/climate.py | 2 +- homeassistant/components/tuya/cover.py | 2 +- homeassistant/components/tuya/{base.py => entity.py} | 0 homeassistant/components/tuya/fan.py | 2 +- homeassistant/components/tuya/humidifier.py | 2 +- homeassistant/components/tuya/light.py | 2 +- homeassistant/components/tuya/number.py | 2 +- homeassistant/components/tuya/select.py | 2 +- homeassistant/components/tuya/sensor.py | 2 +- homeassistant/components/tuya/siren.py | 2 +- homeassistant/components/tuya/switch.py | 2 +- homeassistant/components/tuya/vacuum.py | 2 +- 16 files changed, 15 insertions(+), 15 deletions(-) rename homeassistant/components/tuya/{base.py => entity.py} (100%) diff --git a/homeassistant/components/tuya/alarm_control_panel.py b/homeassistant/components/tuya/alarm_control_panel.py index 29da625a990..fbea8d352a0 100644 --- a/homeassistant/components/tuya/alarm_control_panel.py +++ b/homeassistant/components/tuya/alarm_control_panel.py @@ -22,8 +22,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import TuyaConfigEntry -from .base import TuyaEntity from .const import TUYA_DISCOVERY_NEW, DPCode, DPType +from .entity import TuyaEntity class Mode(StrEnum): diff --git a/homeassistant/components/tuya/binary_sensor.py b/homeassistant/components/tuya/binary_sensor.py index 2d6d9b478c8..4759a24905a 100644 --- a/homeassistant/components/tuya/binary_sensor.py +++ b/homeassistant/components/tuya/binary_sensor.py @@ -17,8 +17,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import TuyaConfigEntry -from .base import TuyaEntity from .const import TUYA_DISCOVERY_NEW, DPCode +from .entity import TuyaEntity @dataclass(frozen=True) diff --git a/homeassistant/components/tuya/button.py b/homeassistant/components/tuya/button.py index f62bba928b4..f77fed776b0 100644 --- a/homeassistant/components/tuya/button.py +++ b/homeassistant/components/tuya/button.py @@ -11,8 +11,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import TuyaConfigEntry -from .base import TuyaEntity from .const import TUYA_DISCOVERY_NEW, DPCode +from .entity import TuyaEntity # All descriptions can be found here. # https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq diff --git a/homeassistant/components/tuya/camera.py b/homeassistant/components/tuya/camera.py index f3913611b07..9e66531dd51 100644 --- a/homeassistant/components/tuya/camera.py +++ b/homeassistant/components/tuya/camera.py @@ -11,8 +11,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import TuyaConfigEntry -from .base import TuyaEntity from .const import TUYA_DISCOVERY_NEW, DPCode +from .entity import TuyaEntity # All descriptions can be found here: # https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq diff --git a/homeassistant/components/tuya/climate.py b/homeassistant/components/tuya/climate.py index d47c71532a4..93aaaa40c26 100644 --- a/homeassistant/components/tuya/climate.py +++ b/homeassistant/components/tuya/climate.py @@ -24,8 +24,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import TuyaConfigEntry -from .base import IntegerTypeData, TuyaEntity from .const import TUYA_DISCOVERY_NEW, DPCode, DPType +from .entity import IntegerTypeData, TuyaEntity TUYA_HVAC_TO_HA = { "auto": HVACMode.HEAT_COOL, diff --git a/homeassistant/components/tuya/cover.py b/homeassistant/components/tuya/cover.py index e92c6f5c5f2..9c3269c27f2 100644 --- a/homeassistant/components/tuya/cover.py +++ b/homeassistant/components/tuya/cover.py @@ -20,8 +20,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import TuyaConfigEntry -from .base import IntegerTypeData, TuyaEntity from .const import TUYA_DISCOVERY_NEW, DPCode, DPType +from .entity import IntegerTypeData, TuyaEntity @dataclass(frozen=True) diff --git a/homeassistant/components/tuya/base.py b/homeassistant/components/tuya/entity.py similarity index 100% rename from homeassistant/components/tuya/base.py rename to homeassistant/components/tuya/entity.py diff --git a/homeassistant/components/tuya/fan.py b/homeassistant/components/tuya/fan.py index 01a7ccf5083..4a6de1cae09 100644 --- a/homeassistant/components/tuya/fan.py +++ b/homeassistant/components/tuya/fan.py @@ -21,8 +21,8 @@ from homeassistant.util.percentage import ( ) from . import TuyaConfigEntry -from .base import EnumTypeData, IntegerTypeData, TuyaEntity from .const import TUYA_DISCOVERY_NEW, DPCode, DPType +from .entity import EnumTypeData, IntegerTypeData, TuyaEntity TUYA_SUPPORT_TYPE = { "fs", # Fan diff --git a/homeassistant/components/tuya/humidifier.py b/homeassistant/components/tuya/humidifier.py index 3d16b0dfbbb..cb872d67719 100644 --- a/homeassistant/components/tuya/humidifier.py +++ b/homeassistant/components/tuya/humidifier.py @@ -17,8 +17,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import TuyaConfigEntry -from .base import IntegerTypeData, TuyaEntity from .const import TUYA_DISCOVERY_NEW, DPCode, DPType +from .entity import IntegerTypeData, TuyaEntity @dataclass(frozen=True) diff --git a/homeassistant/components/tuya/light.py b/homeassistant/components/tuya/light.py index 0c07eb05aac..060b1f4b7ef 100644 --- a/homeassistant/components/tuya/light.py +++ b/homeassistant/components/tuya/light.py @@ -23,8 +23,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import TuyaConfigEntry -from .base import IntegerTypeData, TuyaEntity from .const import TUYA_DISCOVERY_NEW, DPCode, DPType, WorkMode +from .entity import IntegerTypeData, TuyaEntity from .util import remap_value diff --git a/homeassistant/components/tuya/number.py b/homeassistant/components/tuya/number.py index d7614fb837a..d989cad07bb 100644 --- a/homeassistant/components/tuya/number.py +++ b/homeassistant/components/tuya/number.py @@ -15,8 +15,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import TuyaConfigEntry -from .base import IntegerTypeData, TuyaEntity from .const import DEVICE_CLASS_UNITS, DOMAIN, TUYA_DISCOVERY_NEW, DPCode, DPType +from .entity import IntegerTypeData, TuyaEntity # All descriptions can be found here. Mostly the Integer data types in the # default instructions set of each category end up being a number. diff --git a/homeassistant/components/tuya/select.py b/homeassistant/components/tuya/select.py index 111b9e40918..abc5e4c496b 100644 --- a/homeassistant/components/tuya/select.py +++ b/homeassistant/components/tuya/select.py @@ -11,8 +11,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import TuyaConfigEntry -from .base import TuyaEntity from .const import TUYA_DISCOVERY_NEW, DPCode, DPType +from .entity import TuyaEntity # All descriptions can be found here. Mostly the Enum data types in the # default instructions set of each category end up being a select. diff --git a/homeassistant/components/tuya/sensor.py b/homeassistant/components/tuya/sensor.py index 4f3c6099377..fd8efcac95d 100644 --- a/homeassistant/components/tuya/sensor.py +++ b/homeassistant/components/tuya/sensor.py @@ -27,7 +27,6 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import StateType from . import TuyaConfigEntry -from .base import ElectricityTypeData, EnumTypeData, IntegerTypeData, TuyaEntity from .const import ( DEVICE_CLASS_UNITS, DOMAIN, @@ -36,6 +35,7 @@ from .const import ( DPType, UnitOfMeasurement, ) +from .entity import ElectricityTypeData, EnumTypeData, IntegerTypeData, TuyaEntity @dataclass(frozen=True) diff --git a/homeassistant/components/tuya/siren.py b/homeassistant/components/tuya/siren.py index 683705c6546..334dced134d 100644 --- a/homeassistant/components/tuya/siren.py +++ b/homeassistant/components/tuya/siren.py @@ -16,8 +16,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import TuyaConfigEntry -from .base import TuyaEntity from .const import TUYA_DISCOVERY_NEW, DPCode +from .entity import TuyaEntity # All descriptions can be found here: # https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq diff --git a/homeassistant/components/tuya/switch.py b/homeassistant/components/tuya/switch.py index 8af9a00ab45..77432c5b9a5 100644 --- a/homeassistant/components/tuya/switch.py +++ b/homeassistant/components/tuya/switch.py @@ -17,8 +17,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import TuyaConfigEntry -from .base import TuyaEntity from .const import TUYA_DISCOVERY_NEW, DPCode +from .entity import TuyaEntity # All descriptions can be found here. Mostly the Boolean data types in the # default instruction set of each category end up being a Switch. diff --git a/homeassistant/components/tuya/vacuum.py b/homeassistant/components/tuya/vacuum.py index 360d6d4f5c3..2e0a154e670 100644 --- a/homeassistant/components/tuya/vacuum.py +++ b/homeassistant/components/tuya/vacuum.py @@ -19,8 +19,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import TuyaConfigEntry -from .base import EnumTypeData, IntegerTypeData, TuyaEntity from .const import TUYA_DISCOVERY_NEW, DPCode, DPType +from .entity import EnumTypeData, IntegerTypeData, TuyaEntity TUYA_MODE_RETURN_HOME = "chargego" TUYA_STATUS_TO_HA = {