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."""
_attr_icon = "mdi:security"
_attr_name = None
def __init__(
self,

View File

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

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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."""