Add Tuya Fingerbot device support (#59880)

This commit is contained in:
PlusPlus-ua 2021-11-29 17:52:15 +02:00 committed by GitHub
parent 9aa33a3cf8
commit 2be7773f5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 53 additions and 0 deletions

View file

@ -85,6 +85,7 @@ DEVICE_CLASS_TUYA_MOTION_SENSITIVITY = "tuya__motion_sensitivity"
DEVICE_CLASS_TUYA_RECORD_MODE = "tuya__record_mode"
DEVICE_CLASS_TUYA_RELAY_STATUS = "tuya__relay_status"
DEVICE_CLASS_TUYA_STATUS = "tuya__status"
DEVICE_CLASS_TUYA_FINGERBOT_MODE = "tuya__fingerbot_mode"
TUYA_DISCOVERY_NEW = "tuya_discovery_new"
TUYA_HA_SIGNAL_UPDATE_ENTITY = "tuya_entry_update"
@ -138,6 +139,8 @@ class DPCode(str, Enum):
ANGLE_HORIZONTAL = "angle_horizontal"
ANGLE_VERTICAL = "angle_vertical"
ANION = "anion" # Ionizer unit
ARM_DOWN_PERCENT = "arm_down_percent"
ARM_UP_PERCENT = "arm_up_percent"
BASIC_ANTI_FLICKER = "basic_anti_flicker"
BASIC_DEVICE_VOLUME = "basic_device_volume"
BASIC_FLIP = "basic_flip"
@ -168,6 +171,7 @@ class DPCode(str, Enum):
CH4_SENSOR_STATE = "ch4_sensor_state"
CH4_SENSOR_VALUE = "ch4_sensor_value"
CHILD_LOCK = "child_lock" # Child lock
CLICK_SUSTAIN_TIME = "click_sustain_time"
CO_STATE = "co_state"
CO_STATUS = "co_status"
CO_VALUE = "co_value"

View file

@ -209,6 +209,27 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
entity_category=ENTITY_CATEGORY_CONFIG,
),
),
# Fingerbot
"szjqr": (
NumberEntityDescription(
key=DPCode.ARM_DOWN_PERCENT,
name="Move Down %",
icon="mdi:arrow-down-bold",
entity_category=ENTITY_CATEGORY_CONFIG,
),
NumberEntityDescription(
key=DPCode.ARM_UP_PERCENT,
name="Move Up %",
icon="mdi:arrow-up-bold",
entity_category=ENTITY_CATEGORY_CONFIG,
),
NumberEntityDescription(
key=DPCode.CLICK_SUSTAIN_TIME,
name="Down Delay",
icon="mdi:timer",
entity_category=ENTITY_CATEGORY_CONFIG,
),
),
}

View file

@ -19,6 +19,7 @@ from .const import (
DEVICE_CLASS_TUYA_BASIC_ANTI_FLICKR,
DEVICE_CLASS_TUYA_BASIC_NIGHTVISION,
DEVICE_CLASS_TUYA_DECIBEL_SENSITIVITY,
DEVICE_CLASS_TUYA_FINGERBOT_MODE,
DEVICE_CLASS_TUYA_IPC_WORK_MODE,
DEVICE_CLASS_TUYA_LED_TYPE,
DEVICE_CLASS_TUYA_LIGHT_MODE,
@ -209,6 +210,15 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
entity_category=ENTITY_CATEGORY_CONFIG,
),
),
# Fingerbot
"szjqr": (
SelectEntityDescription(
key=DPCode.MODE,
name="Mode",
device_class=DEVICE_CLASS_TUYA_FINGERBOT_MODE,
entity_category=ENTITY_CATEGORY_CONFIG,
),
),
}

View file

@ -496,6 +496,8 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
# Vibration Sensor
# https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno
"zd": BATTERY_SENSORS,
# Fingerbot
"szjqr": BATTERY_SENSORS,
}
# Socket (duplicate of `kg`)

View file

@ -44,6 +44,10 @@
"on": "[%key:common::state::on%]",
"power_off": "[%key:common::state::off%]",
"power_on": "[%key:common::state::on%]"
},
"tuya__fingerbot_mode": {
"click": "Push",
"switch": "Switch"
}
}
}

View file

@ -449,6 +449,14 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
entity_category=ENTITY_CATEGORY_CONFIG,
),
),
# Fingerbot
"szjqr": (
SwitchEntityDescription(
key=DPCode.SWITCH,
name="Switch",
icon="mdi:cursor-pointer",
),
),
}
# Socket (duplicate of `pc`)

View file

@ -44,6 +44,10 @@
"on": "On",
"power_off": "Off",
"power_on": "On"
},
"tuya__fingerbot_mode": {
"click": "Push",
"switch": "Switch"
}
}
}