From b5f215960f8378fce57712a2df5f7c3499aa3e58 Mon Sep 17 00:00:00 2001 From: Heindrich Paul Date: Sat, 8 Nov 2025 11:30:01 +0100 Subject: [PATCH] Add fixture for Poopy Nano 2 device in Tuya tests (#156048) Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> --- tests/components/tuya/__init__.py | 1 + .../tuya/fixtures/msp_mzuro9jgjs7uiryn.json | 155 +++++++++++++++++ .../components/tuya/snapshots/test_init.ambr | 31 ++++ .../tuya/snapshots/test_sensor.ambr | 158 ++++++++++++++++++ 4 files changed, 345 insertions(+) create mode 100644 tests/components/tuya/fixtures/msp_mzuro9jgjs7uiryn.json diff --git a/tests/components/tuya/__init__.py b/tests/components/tuya/__init__.py index ad48084dd59..2fb743228d9 100644 --- a/tests/components/tuya/__init__.py +++ b/tests/components/tuya/__init__.py @@ -173,6 +173,7 @@ DEVICE_MOCKS = [ "mcs_oxslv1c9", # https://github.com/home-assistant/core/issues/139966 "mcs_qxu3flpqjsc1kqu3", # https://github.com/home-assistant/core/issues/141278 "msp_3ddulzljdjjwkhoy", # https://github.com/orgs/home-assistant/discussions/262 + "msp_mzuro9jgjs7uiryn", # https://github.com/home-assistant/core/pull/156048 "mzj_jlapoy5liocmtdvd", # https://github.com/home-assistant/core/issues/150662 "mzj_qavcakohisj5adyh", # https://github.com/home-assistant/core/issues/141278 "ntq_9mqdhwklpvnnvb7t", # https://github.com/orgs/home-assistant/discussions/517 diff --git a/tests/components/tuya/fixtures/msp_mzuro9jgjs7uiryn.json b/tests/components/tuya/fixtures/msp_mzuro9jgjs7uiryn.json new file mode 100644 index 00000000000..3122b13b019 --- /dev/null +++ b/tests/components/tuya/fixtures/msp_mzuro9jgjs7uiryn.json @@ -0,0 +1,155 @@ +{ + "endpoint": "https://apigw.tuyaeu.com", + "mqtt_connected": true, + "disabled_by": null, + "disabled_polling": false, + "name": "Poopy Nano 2", + "category": "msp", + "product_id": "mzuro9jgjs7uiryn", + "product_name": "Poopy Nano 2", + "online": true, + "sub": false, + "time_zone": "+02:00", + "active_time": "2025-07-08T18:02:16+00:00", + "create_time": "2025-07-08T18:02:16+00:00", + "update_time": "2025-07-08T18:02:16+00:00", + "function": { + "switch": { + "type": "Boolean", + "value": {} + }, + "start": { + "type": "Boolean", + "value": {} + }, + "auto_clean": { + "type": "Boolean", + "value": {} + }, + "delay_clean_time": { + "type": "Integer", + "value": { + "unit": "s", + "min": 1, + "max": 600, + "scale": 0, + "step": 1 + } + }, + "manual_clean": { + "type": "Boolean", + "value": {} + }, + "factory_reset": { + "type": "Boolean", + "value": {} + }, + "status": { + "type": "Enum", + "value": { + "range": ["sleep"] + } + } + }, + "status_range": { + "switch": { + "type": "Boolean", + "value": {} + }, + "start": { + "type": "Boolean", + "value": {} + }, + "auto_clean": { + "type": "Boolean", + "value": {} + }, + "delay_clean_time": { + "type": "Integer", + "value": { + "unit": "s", + "min": 1, + "max": 600, + "scale": 0, + "step": 1 + } + }, + "cat_weight": { + "type": "Integer", + "value": { + "unit": "kg", + "min": 6, + "max": 100, + "scale": 1, + "step": 1 + } + }, + "excretion_times_day": { + "type": "Integer", + "value": { + "unit": "times", + "min": 0, + "max": 999999999, + "scale": 0, + "step": 1 + } + }, + "excretion_time_day": { + "type": "Integer", + "value": { + "unit": "s", + "min": 0, + "max": 1800, + "scale": 0, + "step": 1 + } + }, + "manual_clean": { + "type": "Boolean", + "value": {} + }, + "notification": { + "type": "Bitmap", + "value": { + "label": [ + "garbage_box_full", + "excessive_clean_times", + "cleaning", + "no_weight" + ] + } + }, + "fault": { + "type": "Bitmap", + "value": { + "label": ["E01", "E02", "E03", "00"] + } + }, + "factory_reset": { + "type": "Boolean", + "value": {} + }, + "status": { + "type": "Enum", + "value": { + "range": ["sleep"] + } + } + }, + "status": { + "switch": true, + "start": false, + "auto_clean": false, + "delay_clean_time": 1, + "cat_weight": 36, + "excretion_times_day": 4, + "excretion_time_day": 85, + "manual_clean": false, + "notification": 0, + "fault": 0, + "factory_reset": false, + "status": "standly" + }, + "set_up": true, + "support_local": true +} diff --git a/tests/components/tuya/snapshots/test_init.ambr b/tests/components/tuya/snapshots/test_init.ambr index e0f256512bc..829110717a7 100644 --- a/tests/components/tuya/snapshots/test_init.ambr +++ b/tests/components/tuya/snapshots/test_init.ambr @@ -5393,6 +5393,37 @@ 'via_device_id': None, }) # --- +# name: test_device_registry[nyriu7sjgj9oruzmpsm] + DeviceRegistryEntrySnapshot({ + 'area_id': None, + 'config_entries': , + 'config_entries_subentries': , + 'configuration_url': None, + 'connections': set({ + }), + 'disabled_by': None, + 'entry_type': None, + 'hw_version': None, + 'id': , + 'identifiers': set({ + tuple( + 'tuya', + 'nyriu7sjgj9oruzmpsm', + ), + }), + 'labels': set({ + }), + 'manufacturer': 'Tuya', + 'model': 'Poopy Nano 2', + 'model_id': 'mzuro9jgjs7uiryn', + 'name': 'Poopy Nano 2', + 'name_by_user': None, + 'primary_config_entry': , + 'serial_number': None, + 'sw_version': None, + 'via_device_id': None, + }) +# --- # name: test_device_registry[o5kqedcacfng0plpnocfw] DeviceRegistryEntrySnapshot({ 'area_id': None, diff --git a/tests/components/tuya/snapshots/test_sensor.ambr b/tests/components/tuya/snapshots/test_sensor.ambr index 9fab2def208..fd0e3f14e86 100644 --- a/tests/components/tuya/snapshots/test_sensor.ambr +++ b/tests/components/tuya/snapshots/test_sensor.ambr @@ -14882,6 +14882,164 @@ 'state': '0.0', }) # --- +# name: test_platform_setup_and_discovery[sensor.poopy_nano_2_cat_weight-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.poopy_nano_2_cat_weight', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Cat weight', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'cat_weight', + 'unique_id': 'tuya.nyriu7sjgj9oruzmpsmcat_weight', + 'unit_of_measurement': 'kg', + }) +# --- +# name: test_platform_setup_and_discovery[sensor.poopy_nano_2_cat_weight-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'weight', + 'friendly_name': 'Poopy Nano 2 Cat weight', + 'state_class': , + 'unit_of_measurement': 'kg', + }), + 'context': , + 'entity_id': 'sensor.poopy_nano_2_cat_weight', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '3.6', + }) +# --- +# name: test_platform_setup_and_discovery[sensor.poopy_nano_2_excretion_time_day-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.poopy_nano_2_excretion_time_day', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + '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.nyriu7sjgj9oruzmpsmexcretion_time_day', + 'unit_of_measurement': 's', + }) +# --- +# name: test_platform_setup_and_discovery[sensor.poopy_nano_2_excretion_time_day-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'duration', + 'friendly_name': 'Poopy Nano 2 Excretion time (day)', + 'unit_of_measurement': 's', + }), + 'context': , + 'entity_id': 'sensor.poopy_nano_2_excretion_time_day', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '85.0', + }) +# --- +# name: test_platform_setup_and_discovery[sensor.poopy_nano_2_excretion_times_day-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.poopy_nano_2_excretion_times_day', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + '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.nyriu7sjgj9oruzmpsmexcretion_times_day', + 'unit_of_measurement': 'times', + }) +# --- +# name: test_platform_setup_and_discovery[sensor.poopy_nano_2_excretion_times_day-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Poopy Nano 2 Excretion times (day)', + 'unit_of_measurement': 'times', + }), + 'context': , + 'entity_id': 'sensor.poopy_nano_2_excretion_times_day', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '4.0', + }) +# --- # name: test_platform_setup_and_discovery[sensor.production_total_energy-entry] EntityRegistryEntrySnapshot({ 'aliases': set({