Complementing the Tuya Curtain (cl) category (#65023)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
pull/65088/head^2
dougiteixeira 2022-01-27 16:41:13 -03:00 committed by GitHub
parent 8cf1109775
commit 696b930b1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 58 additions and 0 deletions

View File

@ -87,6 +87,8 @@ PLATFORMS = [
class TuyaDeviceClass(StrEnum):
"""Tuya specific device classes, used for translations."""
CURTAIN_MODE = "tuya__curtain_mode"
CURTAIN_MOTOR_MODE = "tuya__curtain_motor_mode"
BASIC_ANTI_FLICKR = "tuya__basic_anti_flickr"
BASIC_NIGHTVISION = "tuya__basic_nightvision"
DECIBEL_SENSITIVITY = "tuya__decibel_sensitivity"
@ -187,7 +189,10 @@ class DPCode(StrEnum):
CONTROL = "control"
CONTROL_2 = "control_2"
CONTROL_3 = "control_3"
CONTROL_BACK = "control_back"
CONTROL_BACK_MODE = "control_back_mode"
COUNTDOWN = "countdown" # Countdown
COUNTDOWN_LEFT = "countdown_left"
COUNTDOWN_SET = "countdown_set" # Countdown setting
CRY_DETECTION_SWITCH = "cry_detection_switch"
CUP_NUMBER = "cup_number" # NUmber of cups
@ -249,6 +254,7 @@ class DPCode(StrEnum):
MOVEMENT_DETECT_PIC = "movement_detect_pic"
MUFFLING = "muffling" # Muffling
NEAR_DETECTION = "near_detection"
OPPOSITE = "opposite"
PAUSE = "pause"
PERCENT_CONTROL = "percent_control"
PERCENT_CONTROL_2 = "percent_control_2"
@ -341,6 +347,7 @@ class DPCode(StrEnum):
TEMP_VALUE = "temp_value" # Color temperature
TEMP_VALUE_V2 = "temp_value_v2"
TEMPER_ALARM = "temper_alarm" # Tamper alarm
TIME_TOTAL = "time_total"
TOTAL_CLEAN_AREA = "total_clean_area"
TOTAL_CLEAN_COUNT = "total_clean_count"
TOTAL_CLEAN_TIME = "total_clean_time"

View File

@ -257,6 +257,23 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
icon="mdi:timer-cog-outline",
),
),
# Curtain
# https://developer.tuya.com/en/docs/iot/f?id=K9gf46o5mtfyc
"cl": (
SelectEntityDescription(
key=DPCode.CONTROL_BACK_MODE,
name="Motor Mode",
device_class=TuyaDeviceClass.CURTAIN_MOTOR_MODE,
entity_category=EntityCategory.CONFIG,
icon="mdi:swap-horizontal",
),
SelectEntityDescription(
key=DPCode.MODE,
name="Mode",
device_class=TuyaDeviceClass.CURTAIN_MODE,
entity_category=EntityCategory.CONFIG,
),
),
}
# Socket (duplicate of `kg`)

View File

@ -729,6 +729,16 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
state_class=SensorStateClass.MEASUREMENT,
),
),
# Curtain
# https://developer.tuya.com/en/docs/iot/s?id=K9gf48qy7wkre
"cl": (
TuyaSensorEntityDescription(
key=DPCode.TIME_TOTAL,
name="Last Operation Duration",
entity_category=EntityCategory.DIAGNOSTIC,
icon="mdi:progress-clock",
),
),
}
# Socket (duplicate of `kg`)

View File

@ -85,6 +85,14 @@
"30": "30°",
"60": "60°",
"90": "90°"
},
"tuya__curtain_mode": {
"morning": "Morning",
"night": "Night"
},
"tuya__curtain_motor_mode": {
"forward": "Forward",
"back": "Back"
}
}
}

View File

@ -514,6 +514,22 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG,
),
),
# Curtain
# https://developer.tuya.com/en/docs/iot/f?id=K9gf46o5mtfyc
"cl": (
SwitchEntityDescription(
key=DPCode.CONTROL_BACK,
name="Reverse",
icon="mdi:swap-horizontal",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.OPPOSITE,
name="Reverse",
icon="mdi:swap-horizontal",
entity_category=EntityCategory.CONFIG,
),
),
}
# Socket (duplicate of `pc`)