Skip to content

Commit 4762c64

Browse files
authored
Add initial support for Tuya msp category (cat toilet) (home-assistant#152035)
1 parent 1b99ffe commit 4762c64

File tree

5 files changed

+71
-1
lines changed

5 files changed

+71
-1
lines changed

homeassistant/components/tuya/const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ class DPCode(StrEnum):
140140
BRIGHTNESS_MIN_2 = "brightness_min_2"
141141
BRIGHTNESS_MIN_3 = "brightness_min_3"
142142
C_F = "c_f" # Temperature unit switching
143+
CAT_WEIGHT = "cat_weight"
143144
CH2O_STATE = "ch2o_state"
144145
CH2O_VALUE = "ch2o_value"
145146
CH4_SENSOR_STATE = "ch4_sensor_state"

homeassistant/components/tuya/sensor.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,16 @@ class TuyaSensorEntityDescription(SensorEntityDescription):
796796
# Door Window Sensor
797797
# https://developer.tuya.com/en/docs/iot/s?id=K9gf48hm02l8m
798798
"mcs": BATTERY_SENSORS,
799+
# Cat toilet
800+
# https://developer.tuya.com/en/docs/iot/s?id=Kakg3srr4ora7
801+
"msp": (
802+
TuyaSensorEntityDescription(
803+
key=DPCode.CAT_WEIGHT,
804+
translation_key="cat_weight",
805+
device_class=SensorDeviceClass.WEIGHT,
806+
state_class=SensorStateClass.MEASUREMENT,
807+
),
808+
),
799809
# Sous Vide Cooker
800810
# https://developer.tuya.com/en/docs/iot/categorymzj?id=Kaiuz2vy130ux
801811
"mzj": (

homeassistant/components/tuya/strings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,9 @@
759759
"water_time": {
760760
"name": "Water usage duration"
761761
},
762+
"cat_weight": {
763+
"name": "Cat weight"
764+
},
762765
"odor_elimination_status": {
763766
"name": "Status",
764767
"state": {

tests/components/tuya/snapshots/test_init.ambr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7119,7 +7119,7 @@
71197119
'labels': set({
71207120
}),
71217121
'manufacturer': 'Tuya',
7122-
'model': 'ZEDAR K1200 (unsupported)',
7122+
'model': 'ZEDAR K1200',
71237123
'model_id': '3ddulzljdjjwkhoy',
71247124
'name': 'Kattenbak',
71257125
'name_by_user': None,

tests/components/tuya/snapshots/test_sensor.ambr

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8842,6 +8842,62 @@
88428842
'state': '3.0',
88438843
})
88448844
# ---
8845+
# name: test_platform_setup_and_discovery[sensor.kattenbak_cat_weight-entry]
8846+
EntityRegistryEntrySnapshot({
8847+
'aliases': set({
8848+
}),
8849+
'area_id': None,
8850+
'capabilities': dict({
8851+
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
8852+
}),
8853+
'config_entry_id': <ANY>,
8854+
'config_subentry_id': <ANY>,
8855+
'device_class': None,
8856+
'device_id': <ANY>,
8857+
'disabled_by': None,
8858+
'domain': 'sensor',
8859+
'entity_category': None,
8860+
'entity_id': 'sensor.kattenbak_cat_weight',
8861+
'has_entity_name': True,
8862+
'hidden_by': None,
8863+
'icon': None,
8864+
'id': <ANY>,
8865+
'labels': set({
8866+
}),
8867+
'name': None,
8868+
'options': dict({
8869+
'sensor': dict({
8870+
'suggested_display_precision': 0,
8871+
}),
8872+
}),
8873+
'original_device_class': <SensorDeviceClass.WEIGHT: 'weight'>,
8874+
'original_icon': None,
8875+
'original_name': 'Cat weight',
8876+
'platform': 'tuya',
8877+
'previous_unique_id': None,
8878+
'suggested_object_id': None,
8879+
'supported_features': 0,
8880+
'translation_key': 'cat_weight',
8881+
'unique_id': 'tuya.yohkwjjdjlzludd3psmcat_weight',
8882+
'unit_of_measurement': 'g',
8883+
})
8884+
# ---
8885+
# name: test_platform_setup_and_discovery[sensor.kattenbak_cat_weight-state]
8886+
StateSnapshot({
8887+
'attributes': ReadOnlyDict({
8888+
'device_class': 'weight',
8889+
'friendly_name': 'Kattenbak Cat weight',
8890+
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
8891+
'unit_of_measurement': 'g',
8892+
}),
8893+
'context': <ANY>,
8894+
'entity_id': 'sensor.kattenbak_cat_weight',
8895+
'last_changed': <ANY>,
8896+
'last_reported': <ANY>,
8897+
'last_updated': <ANY>,
8898+
'state': '0.0',
8899+
})
8900+
# ---
88458901
# name: test_platform_setup_and_discovery[sensor.keller_current-entry]
88468902
EntityRegistryEntrySnapshot({
88478903
'aliases': set({

0 commit comments

Comments
 (0)