Add explicit device name to Tuya (#95511)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Joost Lekkerkerker 2023-06-29 11:24:59 +02:00 committed by GitHub
parent 3c7912f7a4
commit e6c4f98354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 3 deletions

View File

@ -89,6 +89,7 @@ class TuyaAlarmEntity(TuyaEntity, AlarmControlPanelEntity):
"""Tuya Alarm Entity.""" """Tuya Alarm Entity."""
_attr_icon = "mdi:security" _attr_icon = "mdi:security"
_attr_name = None
def __init__( def __init__(
self, self,

View File

@ -52,6 +52,7 @@ class TuyaCameraEntity(TuyaEntity, CameraEntity):
_attr_supported_features = CameraEntityFeature.STREAM _attr_supported_features = CameraEntityFeature.STREAM
_attr_brand = "Tuya" _attr_brand = "Tuya"
_attr_name = None
def __init__( def __init__(
self, self,

View File

@ -125,6 +125,7 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
_set_humidity: IntegerTypeData | None = None _set_humidity: IntegerTypeData | None = None
_set_temperature: IntegerTypeData | None = None _set_temperature: IntegerTypeData | None = None
entity_description: TuyaClimateEntityDescription entity_description: TuyaClimateEntityDescription
_attr_name = None
def __init__( def __init__(
self, self,

View File

@ -65,6 +65,7 @@ class TuyaFanEntity(TuyaEntity, FanEntity):
_speed: IntegerTypeData | None = None _speed: IntegerTypeData | None = None
_speeds: EnumTypeData | None = None _speeds: EnumTypeData | None = None
_switch: DPCode | None = None _switch: DPCode | None = None
_attr_name = None
def __init__( def __init__(
self, self,

View File

@ -86,6 +86,7 @@ class TuyaHumidifierEntity(TuyaEntity, HumidifierEntity):
_set_humidity: IntegerTypeData | None = None _set_humidity: IntegerTypeData | None = None
_switch_dpcode: DPCode | None = None _switch_dpcode: DPCode | None = None
entity_description: TuyaHumidifierEntityDescription entity_description: TuyaHumidifierEntityDescription
_attr_name = None
def __init__( def __init__(
self, self,

View File

@ -79,6 +79,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"dc": ( "dc": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED, key=DPCode.SWITCH_LED,
name=None,
color_mode=DPCode.WORK_MODE, color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_VALUE, brightness=DPCode.BRIGHT_VALUE,
color_temp=DPCode.TEMP_VALUE, color_temp=DPCode.TEMP_VALUE,
@ -90,6 +91,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"dd": ( "dd": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED, key=DPCode.SWITCH_LED,
name=None,
color_mode=DPCode.WORK_MODE, color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_VALUE, brightness=DPCode.BRIGHT_VALUE,
color_temp=DPCode.TEMP_VALUE, color_temp=DPCode.TEMP_VALUE,
@ -102,6 +104,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"dj": ( "dj": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED, key=DPCode.SWITCH_LED,
name=None,
color_mode=DPCode.WORK_MODE, color_mode=DPCode.WORK_MODE,
brightness=(DPCode.BRIGHT_VALUE_V2, DPCode.BRIGHT_VALUE), brightness=(DPCode.BRIGHT_VALUE_V2, DPCode.BRIGHT_VALUE),
color_temp=(DPCode.TEMP_VALUE_V2, DPCode.TEMP_VALUE), color_temp=(DPCode.TEMP_VALUE_V2, DPCode.TEMP_VALUE),
@ -120,6 +123,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"fsd": ( "fsd": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED, key=DPCode.SWITCH_LED,
name=None,
color_mode=DPCode.WORK_MODE, color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_VALUE, brightness=DPCode.BRIGHT_VALUE,
color_temp=DPCode.TEMP_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 # Some ceiling fan lights use LIGHT for DPCode instead of SWITCH_LED
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.LIGHT, key=DPCode.LIGHT,
name=None,
), ),
), ),
# Ambient Light # Ambient Light
@ -135,6 +140,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"fwd": ( "fwd": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED, key=DPCode.SWITCH_LED,
name=None,
color_mode=DPCode.WORK_MODE, color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_VALUE, brightness=DPCode.BRIGHT_VALUE,
color_temp=DPCode.TEMP_VALUE, color_temp=DPCode.TEMP_VALUE,
@ -146,6 +152,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"gyd": ( "gyd": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED, key=DPCode.SWITCH_LED,
name=None,
color_mode=DPCode.WORK_MODE, color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_VALUE, brightness=DPCode.BRIGHT_VALUE,
color_temp=DPCode.TEMP_VALUE, color_temp=DPCode.TEMP_VALUE,
@ -157,6 +164,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"jsq": ( "jsq": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED, key=DPCode.SWITCH_LED,
name=None,
color_mode=DPCode.WORK_MODE, color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_VALUE, brightness=DPCode.BRIGHT_VALUE,
color_data=DPCode.COLOUR_DATA_HSV, color_data=DPCode.COLOUR_DATA_HSV,
@ -195,6 +203,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"mbd": ( "mbd": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED, key=DPCode.SWITCH_LED,
name=None,
color_mode=DPCode.WORK_MODE, color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_VALUE, brightness=DPCode.BRIGHT_VALUE,
color_data=DPCode.COLOUR_DATA, color_data=DPCode.COLOUR_DATA,
@ -206,6 +215,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"qjdcz": ( "qjdcz": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED, key=DPCode.SWITCH_LED,
name=None,
color_mode=DPCode.WORK_MODE, color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_VALUE, brightness=DPCode.BRIGHT_VALUE,
color_data=DPCode.COLOUR_DATA, color_data=DPCode.COLOUR_DATA,
@ -296,6 +306,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"tyndj": ( "tyndj": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED, key=DPCode.SWITCH_LED,
name=None,
color_mode=DPCode.WORK_MODE, color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_VALUE, brightness=DPCode.BRIGHT_VALUE,
color_temp=DPCode.TEMP_VALUE, color_temp=DPCode.TEMP_VALUE,
@ -307,6 +318,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"xdd": ( "xdd": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED, key=DPCode.SWITCH_LED,
name=None,
color_mode=DPCode.WORK_MODE, color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_VALUE, brightness=DPCode.BRIGHT_VALUE,
color_temp=DPCode.TEMP_VALUE, color_temp=DPCode.TEMP_VALUE,
@ -322,6 +334,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"ykq": ( "ykq": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_CONTROLLER, key=DPCode.SWITCH_CONTROLLER,
name=None,
color_mode=DPCode.WORK_MODE, color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_CONTROLLER, brightness=DPCode.BRIGHT_CONTROLLER,
color_temp=DPCode.TEMP_CONTROLLER, color_temp=DPCode.TEMP_CONTROLLER,
@ -332,6 +345,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"fs": ( "fs": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.LIGHT, key=DPCode.LIGHT,
name=None,
color_mode=DPCode.WORK_MODE, color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_VALUE, brightness=DPCode.BRIGHT_VALUE,
color_temp=DPCode.TEMP_VALUE, color_temp=DPCode.TEMP_VALUE,

View File

@ -27,7 +27,6 @@ SIRENS: dict[str, tuple[SirenEntityDescription, ...]] = {
"dgnbj": ( "dgnbj": (
SirenEntityDescription( SirenEntityDescription(
key=DPCode.ALARM_SWITCH, key=DPCode.ALARM_SWITCH,
name="Siren",
), ),
), ),
# Siren Alarm # Siren Alarm
@ -35,7 +34,6 @@ SIRENS: dict[str, tuple[SirenEntityDescription, ...]] = {
"sgbj": ( "sgbj": (
SirenEntityDescription( SirenEntityDescription(
key=DPCode.ALARM_SWITCH, key=DPCode.ALARM_SWITCH,
name="Siren",
), ),
), ),
# Smart Camera # Smart Camera
@ -43,7 +41,6 @@ SIRENS: dict[str, tuple[SirenEntityDescription, ...]] = {
"sp": ( "sp": (
SirenEntityDescription( SirenEntityDescription(
key=DPCode.SIREN_SWITCH, key=DPCode.SIREN_SWITCH,
name="Siren",
), ),
), ),
} }
@ -83,6 +80,7 @@ class TuyaSirenEntity(TuyaEntity, SirenEntity):
"""Tuya Siren Entity.""" """Tuya Siren Entity."""
_attr_supported_features = SirenEntityFeature.TURN_ON | SirenEntityFeature.TURN_OFF _attr_supported_features = SirenEntityFeature.TURN_ON | SirenEntityFeature.TURN_OFF
_attr_name = None
def __init__( def __init__(
self, self,

View File

@ -78,6 +78,7 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
_fan_speed: EnumTypeData | None = None _fan_speed: EnumTypeData | None = None
_battery_level: IntegerTypeData | None = None _battery_level: IntegerTypeData | None = None
_attr_name = None
def __init__(self, device: TuyaDevice, device_manager: TuyaDeviceManager) -> None: def __init__(self, device: TuyaDevice, device_manager: TuyaDeviceManager) -> None:
"""Init Tuya vacuum.""" """Init Tuya vacuum."""