1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-25 05:26:47 +00:00

Add sensors for Tuya cat toilet (#155245)

This commit is contained in:
epenet
2025-10-29 11:50:38 +01:00
committed by GitHub
parent d9d4cc9004
commit e4103137ef
6 changed files with 241 additions and 0 deletions

View File

@@ -222,6 +222,24 @@ BINARY_SENSORS: dict[DeviceCategory, tuple[TuyaBinarySensorEntityDescription, ..
on_value={"AQAB"},
),
),
DeviceCategory.MSP: (
TuyaBinarySensorEntityDescription(
key=f"{DPCode.FAULT}_full_fault",
dpcode=DPCode.FAULT,
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
bitmap_key="full_fault",
translation_key="bag_full",
),
TuyaBinarySensorEntityDescription(
key=f"{DPCode.FAULT}_box_out",
dpcode=DPCode.FAULT,
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
bitmap_key="box_out",
translation_key="cover_off",
),
),
DeviceCategory.PIR: (
TuyaBinarySensorEntityDescription(
key=DPCode.PIR,

View File

@@ -714,6 +714,8 @@ class DPCode(StrEnum):
ECO2 = "eco2"
EDGE_BRUSH = "edge_brush"
ELECTRICITY_LEFT = "electricity_left"
EXCRETION_TIME_DAY = "excretion_time_day"
EXCRETION_TIMES_DAY = "excretion_times_day"
FAN_BEEP = "fan_beep" # Sound
FAN_COOL = "fan_cool" # Cool wind
FAN_DIRECTION = "fan_direction" # Fan direction

View File

@@ -760,6 +760,15 @@ SENSORS: dict[DeviceCategory, tuple[TuyaSensorEntityDescription, ...]] = {
device_class=SensorDeviceClass.WEIGHT,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.EXCRETION_TIME_DAY,
translation_key="excretion_time_day",
device_class=SensorDeviceClass.DURATION,
),
TuyaSensorEntityDescription(
key=DPCode.EXCRETION_TIMES_DAY,
translation_key="excretion_times_day",
),
),
DeviceCategory.MZJ: (
TuyaSensorEntityDescription(

View File

@@ -27,12 +27,18 @@
},
"entity": {
"binary_sensor": {
"bag_full": {
"name": "Bag full"
},
"carbon_dioxide": {
"name": "Carbon dioxide"
},
"carbon_monoxide": {
"name": "Carbon monoxide"
},
"cover_off": {
"name": "Cover off"
},
"defrost": {
"name": "Defrost"
},
@@ -620,6 +626,12 @@
"duster_cloth_life": {
"name": "Duster cloth lifetime"
},
"excretion_time_day": {
"name": "Excretion time (day)"
},
"excretion_times_day": {
"name": "Excretion times (day)"
},
"feels_like_temperature": {
"name": "Feels like"
},

View File

@@ -831,6 +831,104 @@
'state': 'unavailable',
})
# ---
# name: test_platform_setup_and_discovery[binary_sensor.kattenbak_bag_full-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.kattenbak_bag_full',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
'original_icon': None,
'original_name': 'Bag full',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'bag_full',
'unique_id': 'tuya.yohkwjjdjlzludd3psmfault_full_fault',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[binary_sensor.kattenbak_bag_full-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'problem',
'friendly_name': 'Kattenbak Bag full',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.kattenbak_bag_full',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[binary_sensor.kattenbak_cover_off-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.kattenbak_cover_off',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
'original_icon': None,
'original_name': 'Cover off',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'cover_off',
'unique_id': 'tuya.yohkwjjdjlzludd3psmfault_box_out',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[binary_sensor.kattenbak_cover_off-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'problem',
'friendly_name': 'Kattenbak Cover off',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.kattenbak_cover_off',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[binary_sensor.mesh_gateway_problem-entry]
EntityRegistryEntrySnapshot({
'aliases': set({

View File

@@ -9844,6 +9844,108 @@
'state': '0.0',
})
# ---
# name: test_platform_setup_and_discovery[sensor.kattenbak_excretion_time_day-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.kattenbak_excretion_time_day',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
'sensor': dict({
'suggested_display_precision': 2,
}),
}),
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
'original_icon': None,
'original_name': 'Excretion time (day)',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'excretion_time_day',
'unique_id': 'tuya.yohkwjjdjlzludd3psmexcretion_time_day',
'unit_of_measurement': 's',
})
# ---
# name: test_platform_setup_and_discovery[sensor.kattenbak_excretion_time_day-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'duration',
'friendly_name': 'Kattenbak Excretion time (day)',
'unit_of_measurement': 's',
}),
'context': <ANY>,
'entity_id': 'sensor.kattenbak_excretion_time_day',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '35.0',
})
# ---
# name: test_platform_setup_and_discovery[sensor.kattenbak_excretion_times_day-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.kattenbak_excretion_times_day',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Excretion times (day)',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'excretion_times_day',
'unique_id': 'tuya.yohkwjjdjlzludd3psmexcretion_times_day',
'unit_of_measurement': 'times',
})
# ---
# name: test_platform_setup_and_discovery[sensor.kattenbak_excretion_times_day-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Kattenbak Excretion times (day)',
'unit_of_measurement': 'times',
}),
'context': <ANY>,
'entity_id': 'sensor.kattenbak_excretion_times_day',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '1.0',
})
# ---
# name: test_platform_setup_and_discovery[sensor.keller_current-entry]
EntityRegistryEntrySnapshot({
'aliases': set({