From e6c4f9835415b695ccafa7d7847b426ea7bbd5b4 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Thu, 29 Jun 2023 11:24:59 +0200 Subject: [PATCH] Add explicit device name to Tuya (#95511) Co-authored-by: Franck Nijhof --- .../components/tuya/alarm_control_panel.py | 1 + homeassistant/components/tuya/camera.py | 1 + homeassistant/components/tuya/climate.py | 1 + homeassistant/components/tuya/fan.py | 1 + homeassistant/components/tuya/humidifier.py | 1 + homeassistant/components/tuya/light.py | 14 ++++++++++++++ homeassistant/components/tuya/siren.py | 4 +--- homeassistant/components/tuya/vacuum.py | 1 + 8 files changed, 21 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/tuya/alarm_control_panel.py b/homeassistant/components/tuya/alarm_control_panel.py index d5122862e2c..c2c9c207c02 100644 --- a/homeassistant/components/tuya/alarm_control_panel.py +++ b/homeassistant/components/tuya/alarm_control_panel.py @@ -89,6 +89,7 @@ class TuyaAlarmEntity(TuyaEntity, AlarmControlPanelEntity): """Tuya Alarm Entity.""" _attr_icon = "mdi:security" + _attr_name = None def __init__( self, diff --git a/homeassistant/components/tuya/camera.py b/homeassistant/components/tuya/camera.py index 182d0dfd85d..72216057aff 100644 --- a/homeassistant/components/tuya/camera.py +++ b/homeassistant/components/tuya/camera.py @@ -52,6 +52,7 @@ class TuyaCameraEntity(TuyaEntity, CameraEntity): _attr_supported_features = CameraEntityFeature.STREAM _attr_brand = "Tuya" + _attr_name = None def __init__( self, diff --git a/homeassistant/components/tuya/climate.py b/homeassistant/components/tuya/climate.py index bcb97327006..6b3b84ba349 100644 --- a/homeassistant/components/tuya/climate.py +++ b/homeassistant/components/tuya/climate.py @@ -125,6 +125,7 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity): _set_humidity: IntegerTypeData | None = None _set_temperature: IntegerTypeData | None = None entity_description: TuyaClimateEntityDescription + _attr_name = None def __init__( self, diff --git a/homeassistant/components/tuya/fan.py b/homeassistant/components/tuya/fan.py index 59cfee3506c..210cc5c7518 100644 --- a/homeassistant/components/tuya/fan.py +++ b/homeassistant/components/tuya/fan.py @@ -65,6 +65,7 @@ class TuyaFanEntity(TuyaEntity, FanEntity): _speed: IntegerTypeData | None = None _speeds: EnumTypeData | None = None _switch: DPCode | None = None + _attr_name = None def __init__( self, diff --git a/homeassistant/components/tuya/humidifier.py b/homeassistant/components/tuya/humidifier.py index 458a2681186..6d09ba4314c 100644 --- a/homeassistant/components/tuya/humidifier.py +++ b/homeassistant/components/tuya/humidifier.py @@ -86,6 +86,7 @@ class TuyaHumidifierEntity(TuyaEntity, HumidifierEntity): _set_humidity: IntegerTypeData | None = None _switch_dpcode: DPCode | None = None entity_description: TuyaHumidifierEntityDescription + _attr_name = None def __init__( self, diff --git a/homeassistant/components/tuya/light.py b/homeassistant/components/tuya/light.py index 44b3494ca77..3ab4c3568c4 100644 --- a/homeassistant/components/tuya/light.py +++ b/homeassistant/components/tuya/light.py @@ -79,6 +79,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { "dc": ( TuyaLightEntityDescription( key=DPCode.SWITCH_LED, + name=None, color_mode=DPCode.WORK_MODE, brightness=DPCode.BRIGHT_VALUE, color_temp=DPCode.TEMP_VALUE, @@ -90,6 +91,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { "dd": ( TuyaLightEntityDescription( key=DPCode.SWITCH_LED, + name=None, color_mode=DPCode.WORK_MODE, brightness=DPCode.BRIGHT_VALUE, color_temp=DPCode.TEMP_VALUE, @@ -102,6 +104,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { "dj": ( TuyaLightEntityDescription( key=DPCode.SWITCH_LED, + name=None, color_mode=DPCode.WORK_MODE, brightness=(DPCode.BRIGHT_VALUE_V2, DPCode.BRIGHT_VALUE), color_temp=(DPCode.TEMP_VALUE_V2, DPCode.TEMP_VALUE), @@ -120,6 +123,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { "fsd": ( TuyaLightEntityDescription( key=DPCode.SWITCH_LED, + name=None, color_mode=DPCode.WORK_MODE, brightness=DPCode.BRIGHT_VALUE, color_temp=DPCode.TEMP_VALUE, @@ -128,6 +132,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { # Some ceiling fan lights use LIGHT for DPCode instead of SWITCH_LED TuyaLightEntityDescription( key=DPCode.LIGHT, + name=None, ), ), # Ambient Light @@ -135,6 +140,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { "fwd": ( TuyaLightEntityDescription( key=DPCode.SWITCH_LED, + name=None, color_mode=DPCode.WORK_MODE, brightness=DPCode.BRIGHT_VALUE, color_temp=DPCode.TEMP_VALUE, @@ -146,6 +152,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { "gyd": ( TuyaLightEntityDescription( key=DPCode.SWITCH_LED, + name=None, color_mode=DPCode.WORK_MODE, brightness=DPCode.BRIGHT_VALUE, color_temp=DPCode.TEMP_VALUE, @@ -157,6 +164,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { "jsq": ( TuyaLightEntityDescription( key=DPCode.SWITCH_LED, + name=None, color_mode=DPCode.WORK_MODE, brightness=DPCode.BRIGHT_VALUE, color_data=DPCode.COLOUR_DATA_HSV, @@ -195,6 +203,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { "mbd": ( TuyaLightEntityDescription( key=DPCode.SWITCH_LED, + name=None, color_mode=DPCode.WORK_MODE, brightness=DPCode.BRIGHT_VALUE, color_data=DPCode.COLOUR_DATA, @@ -206,6 +215,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { "qjdcz": ( TuyaLightEntityDescription( key=DPCode.SWITCH_LED, + name=None, color_mode=DPCode.WORK_MODE, brightness=DPCode.BRIGHT_VALUE, color_data=DPCode.COLOUR_DATA, @@ -296,6 +306,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { "tyndj": ( TuyaLightEntityDescription( key=DPCode.SWITCH_LED, + name=None, color_mode=DPCode.WORK_MODE, brightness=DPCode.BRIGHT_VALUE, color_temp=DPCode.TEMP_VALUE, @@ -307,6 +318,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { "xdd": ( TuyaLightEntityDescription( key=DPCode.SWITCH_LED, + name=None, color_mode=DPCode.WORK_MODE, brightness=DPCode.BRIGHT_VALUE, color_temp=DPCode.TEMP_VALUE, @@ -322,6 +334,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { "ykq": ( TuyaLightEntityDescription( key=DPCode.SWITCH_CONTROLLER, + name=None, color_mode=DPCode.WORK_MODE, brightness=DPCode.BRIGHT_CONTROLLER, color_temp=DPCode.TEMP_CONTROLLER, @@ -332,6 +345,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { "fs": ( TuyaLightEntityDescription( key=DPCode.LIGHT, + name=None, color_mode=DPCode.WORK_MODE, brightness=DPCode.BRIGHT_VALUE, color_temp=DPCode.TEMP_VALUE, diff --git a/homeassistant/components/tuya/siren.py b/homeassistant/components/tuya/siren.py index a60e24eca86..c2dc8cea99b 100644 --- a/homeassistant/components/tuya/siren.py +++ b/homeassistant/components/tuya/siren.py @@ -27,7 +27,6 @@ SIRENS: dict[str, tuple[SirenEntityDescription, ...]] = { "dgnbj": ( SirenEntityDescription( key=DPCode.ALARM_SWITCH, - name="Siren", ), ), # Siren Alarm @@ -35,7 +34,6 @@ SIRENS: dict[str, tuple[SirenEntityDescription, ...]] = { "sgbj": ( SirenEntityDescription( key=DPCode.ALARM_SWITCH, - name="Siren", ), ), # Smart Camera @@ -43,7 +41,6 @@ SIRENS: dict[str, tuple[SirenEntityDescription, ...]] = { "sp": ( SirenEntityDescription( key=DPCode.SIREN_SWITCH, - name="Siren", ), ), } @@ -83,6 +80,7 @@ class TuyaSirenEntity(TuyaEntity, SirenEntity): """Tuya Siren Entity.""" _attr_supported_features = SirenEntityFeature.TURN_ON | SirenEntityFeature.TURN_OFF + _attr_name = None def __init__( self, diff --git a/homeassistant/components/tuya/vacuum.py b/homeassistant/components/tuya/vacuum.py index 7827fb061ea..a2961a55d78 100644 --- a/homeassistant/components/tuya/vacuum.py +++ b/homeassistant/components/tuya/vacuum.py @@ -78,6 +78,7 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity): _fan_speed: EnumTypeData | None = None _battery_level: IntegerTypeData | None = None + _attr_name = None def __init__(self, device: TuyaDevice, device_manager: TuyaDeviceManager) -> None: """Init Tuya vacuum."""