From 7ab99c028c8c7ea8fae86d9b0f64fc88aaaeb936 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 2 Oct 2025 17:29:14 +0200 Subject: [PATCH] Add new test fixture for Tuya wk category (#153457) --- tests/components/tuya/__init__.py | 1 + .../components/tuya/fixtures/wk_tfbhw0mg.json | 109 ++++++++++++++++++ .../tuya/snapshots/test_climate.ambr | 77 +++++++++++++ .../components/tuya/snapshots/test_init.ambr | 31 +++++ .../tuya/snapshots/test_sensor.ambr | 53 +++++++++ .../tuya/snapshots/test_switch.ambr | 48 ++++++++ 6 files changed, 319 insertions(+) create mode 100644 tests/components/tuya/fixtures/wk_tfbhw0mg.json diff --git a/tests/components/tuya/__init__.py b/tests/components/tuya/__init__.py index 8659f277ad5c..13c24046d2f0 100644 --- a/tests/components/tuya/__init__.py +++ b/tests/components/tuya/__init__.py @@ -236,6 +236,7 @@ DEVICE_MOCKS = [ "wk_fi6dne5tu4t1nm6j", # https://github.com/orgs/home-assistant/discussions/243 "wk_gc1bxoq2hafxpa35", # https://github.com/home-assistant/core/issues/145551 "wk_gogb05wrtredz3bs", # https://github.com/home-assistant/core/issues/136337 + "wk_tfbhw0mg", # https://github.com/home-assistant/core/issues/152282 "wk_y5obtqhuztqsf2mj", # https://github.com/home-assistant/core/issues/139735 "wkcz_gc4b1mdw7kebtuyz", # https://github.com/home-assistant/core/issues/135617 "wkf_9xfjixap", # https://github.com/home-assistant/core/issues/139966 diff --git a/tests/components/tuya/fixtures/wk_tfbhw0mg.json b/tests/components/tuya/fixtures/wk_tfbhw0mg.json new file mode 100644 index 000000000000..4a9186314eaf --- /dev/null +++ b/tests/components/tuya/fixtures/wk_tfbhw0mg.json @@ -0,0 +1,109 @@ +{ + "endpoint": "https://apigw.tuyaeu.com", + "mqtt_connected": true, + "disabled_by": null, + "disabled_polling": false, + "name": "Salon", + "category": "wk", + "product_id": "tfbhw0mg", + "product_name": "ZX-5442", + "online": true, + "sub": true, + "time_zone": "+02:00", + "active_time": "2025-09-13T13:48:55+00:00", + "create_time": "2025-09-13T13:48:55+00:00", + "update_time": "2025-09-13T13:48:55+00:00", + "function": { + "temp_set": { + "type": "Integer", + "value": { + "unit": "\u00b0C", + "min": 1, + "max": 59, + "scale": 1, + "step": 5 + } + }, + "mode": { + "type": "Enum", + "value": { + "range": ["auto", "manual", "holiday"] + } + }, + "child_lock": { + "type": "Boolean", + "value": {} + }, + "holiday_set": { + "type": "String", + "value": { + "maxlen": 255 + } + } + }, + "status_range": { + "temp_set": { + "type": "Integer", + "value": { + "unit": "\u00b0C", + "min": 1, + "max": 59, + "scale": 1, + "step": 5 + } + }, + "temp_current": { + "type": "Integer", + "value": { + "unit": "\u00b0C", + "min": -50, + "max": 350, + "scale": 1, + "step": 5 + } + }, + "mode": { + "type": "Enum", + "value": { + "range": ["auto", "manual", "holiday"] + } + }, + "child_lock": { + "type": "Boolean", + "value": {} + }, + "fault": { + "type": "Bitmap", + "value": { + "label": ["fault1", "fault2", "fault3"] + } + }, + "battery_percentage": { + "type": "Integer", + "value": { + "unit": "V", + "min": 0, + "max": 1000, + "scale": 2, + "step": 1 + } + }, + "holiday_set": { + "type": "String", + "value": { + "maxlen": 255 + } + } + }, + "status": { + "temp_set": 59, + "temp_current": 203, + "mode": "manual", + "child_lock": false, + "fault": 0, + "battery_percentage": 117, + "holiday_set": "FAwZAAAiAAA=" + }, + "set_up": true, + "support_local": true +} diff --git a/tests/components/tuya/snapshots/test_climate.ambr b/tests/components/tuya/snapshots/test_climate.ambr index 2673383f4f2f..87304e5e9adb 100644 --- a/tests/components/tuya/snapshots/test_climate.ambr +++ b/tests/components/tuya/snapshots/test_climate.ambr @@ -860,6 +860,83 @@ 'state': 'off', }) # --- +# name: test_platform_setup_and_discovery[climate.salon-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'hvac_modes': list([ + , + , + , + , + ]), + 'max_temp': 5.9, + 'min_temp': 0.1, + 'preset_modes': list([ + 'holiday', + ]), + 'target_temp_step': 0.5, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'climate', + 'entity_category': None, + 'entity_id': 'climate.salon', + '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': None, + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': 'tuya.gm0whbftkw', + 'unit_of_measurement': None, + }) +# --- +# name: test_platform_setup_and_discovery[climate.salon-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'current_temperature': 20.3, + 'friendly_name': 'Salon', + 'hvac_modes': list([ + , + , + , + , + ]), + 'max_temp': 5.9, + 'min_temp': 0.1, + 'preset_mode': None, + 'preset_modes': list([ + 'holiday', + ]), + 'supported_features': , + 'target_temp_step': 0.5, + 'temperature': 5.9, + }), + 'context': , + 'entity_id': 'climate.salon', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'heat_cool', + }) +# --- # name: test_platform_setup_and_discovery[climate.smart_thermostats-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ diff --git a/tests/components/tuya/snapshots/test_init.ambr b/tests/components/tuya/snapshots/test_init.ambr index c8810beb0e23..67ca9ddec1a1 100644 --- a/tests/components/tuya/snapshots/test_init.ambr +++ b/tests/components/tuya/snapshots/test_init.ambr @@ -3657,6 +3657,37 @@ 'via_device_id': None, }) # --- +# name: test_device_registry[gm0whbftkw] + 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', + 'gm0whbftkw', + ), + }), + 'labels': set({ + }), + 'manufacturer': 'Tuya', + 'model': 'ZX-5442', + 'model_id': 'tfbhw0mg', + 'name': 'Salon', + 'name_by_user': None, + 'primary_config_entry': , + 'serial_number': None, + 'sw_version': None, + 'via_device_id': None, + }) +# --- # name: test_device_registry[gnZOKztbAtcBkEGPzc] DeviceRegistryEntrySnapshot({ 'area_id': None, diff --git a/tests/components/tuya/snapshots/test_sensor.ambr b/tests/components/tuya/snapshots/test_sensor.ambr index 442f6774a0aa..6d20cc5c03da 100644 --- a/tests/components/tuya/snapshots/test_sensor.ambr +++ b/tests/components/tuya/snapshots/test_sensor.ambr @@ -15293,6 +15293,59 @@ 'state': 'high', }) # --- +# name: test_platform_setup_and_discovery[sensor.salon_battery-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': , + 'entity_id': 'sensor.salon_battery', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Battery', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'battery', + 'unique_id': 'tuya.gm0whbftkwbattery_percentage', + 'unit_of_measurement': '%', + }) +# --- +# name: test_platform_setup_and_discovery[sensor.salon_battery-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'battery', + 'friendly_name': 'Salon Battery', + 'state_class': , + 'unit_of_measurement': '%', + }), + 'context': , + 'entity_id': 'sensor.salon_battery', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '1.17', + }) +# --- # name: test_platform_setup_and_discovery[sensor.sapphire_current-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ diff --git a/tests/components/tuya/snapshots/test_switch.ambr b/tests/components/tuya/snapshots/test_switch.ambr index 1b30c6cabea4..041f0eda4f56 100644 --- a/tests/components/tuya/snapshots/test_switch.ambr +++ b/tests/components/tuya/snapshots/test_switch.ambr @@ -7016,6 +7016,54 @@ 'state': 'on', }) # --- +# name: test_platform_setup_and_discovery[switch.salon_child_lock-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'switch', + 'entity_category': , + 'entity_id': 'switch.salon_child_lock', + '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': 'Child lock', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'child_lock', + 'unique_id': 'tuya.gm0whbftkwchild_lock', + 'unit_of_measurement': None, + }) +# --- +# name: test_platform_setup_and_discovery[switch.salon_child_lock-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Salon Child lock', + }), + 'context': , + 'entity_id': 'switch.salon_child_lock', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- # name: test_platform_setup_and_discovery[switch.sapphire_socket-entry] EntityRegistryEntrySnapshot({ 'aliases': set({