Add more Tuya Vacuum sensors and select entities (#60927)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
pull/60933/head
dougiteixeira 2021-12-03 15:38:32 -03:00 committed by GitHub
parent b65b25c1bb
commit fdb13726f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 134 additions and 1 deletions

View File

@ -60,6 +60,9 @@ 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"
DEVICE_CLASS_TUYA_VACUUM_CISTERN = "tuya__vacuum_cistern"
DEVICE_CLASS_TUYA_VACUUM_COLLECTION = "tuya__vacuum_collection"
DEVICE_CLASS_TUYA_VACUUM_MODE = "tuya__vacuum_mode"
TUYA_DISCOVERY_NEW = "tuya_discovery_new"
TUYA_HA_SIGNAL_UPDATE_ENTITY = "tuya_entry_update"
@ -145,12 +148,16 @@ class DPCode(str, Enum):
CH4_SENSOR_STATE = "ch4_sensor_state"
CH4_SENSOR_VALUE = "ch4_sensor_value"
CHILD_LOCK = "child_lock" # Child lock
CISTERN = "cistern"
CLEAN_AREA = "clean_area"
CLEAN_TIME = "clean_time"
CLICK_SUSTAIN_TIME = "click_sustain_time"
CO_STATE = "co_state"
CO_STATUS = "co_status"
CO_VALUE = "co_value"
CO2_STATE = "co2_state"
CO2_VALUE = "co2_value" # CO2 concentration
COLLECTION_MODE = "collection_mode"
COLOR_DATA_V2 = "color_data_v2"
COLOUR_DATA = "colour_data" # Colored light mode
COLOUR_DATA_HSV = "colour_data_hsv" # Colored light mode
@ -171,11 +178,15 @@ class DPCode(str, Enum):
DOORCONTACT_STATE = "doorcontact_state" # Status of door window sensor
DOORCONTACT_STATE_2 = "doorcontact_state_2"
DOORCONTACT_STATE_3 = "doorcontact_state_3"
DUSTER_CLOTH = "duster_cloth"
EDGE_BRUSH = "edge_brush"
ELECTRICITY_LEFT = "electricity_left"
FAN_DIRECTION = "fan_direction" # Fan direction
FAN_SPEED_ENUM = "fan_speed_enum" # Speed mode
FAN_SPEED_PERCENT = "fan_speed_percent" # Stepless speed
FAR_DETECTION = "far_detection"
FAULT = "fault"
FILTER_LIFE = "filter"
FILTER_RESET = "filter_reset" # Filter (cartridge) reset
FLOODLIGHT_LIGHTNESS = "floodlight_lightness"
FLOODLIGHT_SWITCH = "floodlight_switch"
@ -232,6 +243,7 @@ class DPCode(str, Enum):
RESET_FILTER = "reset_filter"
RESET_MAP = "reset_map"
RESET_ROLL_BRUSH = "reset_roll_brush"
ROLL_BRUSH = "roll_brush"
SEEK = "seek"
SENSITIVITY = "sensitivity" # Sensitivity
SENSOR_HUMIDITY = "sensor_humidity"
@ -288,6 +300,9 @@ class DPCode(str, Enum):
TEMP_VALUE = "temp_value" # Color temperature
TEMP_VALUE_V2 = "temp_value_v2"
TEMPER_ALARM = "temper_alarm" # Tamper alarm
TOTAL_CLEAN_AREA = "total_clean_area"
TOTAL_CLEAN_COUNT = "total_clean_count"
TOTAL_CLEAN_TIME = "total_clean_time"
UV = "uv" # UV sterilization
VA_BATTERY = "va_battery"
VA_HUMIDITY = "va_humidity"

View File

@ -26,6 +26,9 @@ from .const import (
DEVICE_CLASS_TUYA_MOTION_SENSITIVITY,
DEVICE_CLASS_TUYA_RECORD_MODE,
DEVICE_CLASS_TUYA_RELAY_STATUS,
DEVICE_CLASS_TUYA_VACUUM_CISTERN,
DEVICE_CLASS_TUYA_VACUUM_COLLECTION,
DEVICE_CLASS_TUYA_VACUUM_MODE,
DOMAIN,
TUYA_DISCOVERY_NEW,
DPCode,
@ -219,6 +222,31 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG,
),
),
# Robot Vacuum
# https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo
"sd": (
SelectEntityDescription(
key=DPCode.CISTERN,
name="Water Tank Adjustment",
entity_category=EntityCategory.CONFIG,
device_class=DEVICE_CLASS_TUYA_VACUUM_CISTERN,
icon="mdi:water-opacity",
),
SelectEntityDescription(
key=DPCode.COLLECTION_MODE,
name="Dust Collection Mode",
entity_category=EntityCategory.CONFIG,
device_class=DEVICE_CLASS_TUYA_VACUUM_COLLECTION,
icon="mdi:air-filter",
),
SelectEntityDescription(
key=DPCode.MODE,
name="Mode",
entity_category=EntityCategory.CONFIG,
device_class=DEVICE_CLASS_TUYA_VACUUM_MODE,
icon="mdi:layers-outline",
),
),
}

View File

@ -579,6 +579,64 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
subkey="voltage",
),
),
# Robot Vacuum
# https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo
"sd": (
TuyaSensorEntityDescription(
key=DPCode.CLEAN_AREA,
name="Cleaning Area",
icon="mdi:texture-box",
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.CLEAN_TIME,
name="Cleaning Time",
icon="mdi:progress-clock",
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.TOTAL_CLEAN_AREA,
name="Total Cleaning Area",
icon="mdi:texture-box",
state_class=SensorStateClass.TOTAL_INCREASING,
),
TuyaSensorEntityDescription(
key=DPCode.TOTAL_CLEAN_TIME,
name="Total Cleaning Time",
icon="mdi:history",
state_class=SensorStateClass.TOTAL_INCREASING,
),
TuyaSensorEntityDescription(
key=DPCode.TOTAL_CLEAN_COUNT,
name="Total Cleaning Times",
icon="mdi:counter",
state_class=SensorStateClass.TOTAL_INCREASING,
),
TuyaSensorEntityDescription(
key=DPCode.DUSTER_CLOTH,
name="Duster Cloth Life",
icon="mdi:ticket-percent-outline",
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.EDGE_BRUSH,
name="Side Brush Life",
icon="mdi:ticket-percent-outline",
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.FILTER_LIFE,
name="Filter Life",
icon="mdi:ticket-percent-outline",
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.ROLL_BRUSH,
name="Rolling Brush Life",
icon="mdi:ticket-percent-outline",
state_class=SensorStateClass.MEASUREMENT,
),
),
}
# Socket (duplicate of `kg`)

View File

@ -48,6 +48,38 @@
"on": "On",
"power_off": "Off",
"power_on": "On"
},
"tuya__vacuum_cistern": {
"low": "Low",
"middle": "Middle",
"high": "High",
"closed": "Closed"
},
"tuya__vacuum_collection": {
"small": "Small",
"middle": "Middle",
"large": "Large"
},
"tuya__vacuum_mode": {
"standby": "Standby",
"random": "Random",
"smart": "Smart",
"wall_follow": "Follow Wall",
"mop": "Mop",
"spiral": "Spiral",
"left_spiral": "Spiral Left",
"right_spiral": "Spiral Right",
"bow": "Bow",
"left_bow": "Bow Lef",
"right_bow": "Bow Right",
"partial_bow": "Bow Partially",
"chargego": "Return to dock",
"single": "Single",
"zone": "Zone",
"pose": "Pose",
"point": "Point",
"part": "Part",
"pick_zone": "Pick Zone"
}
}
}
}