diff --git a/homeassistant/components/tuya/sensor.py b/homeassistant/components/tuya/sensor.py index 48543f2cd48..fe7db2b28b9 100644 --- a/homeassistant/components/tuya/sensor.py +++ b/homeassistant/components/tuya/sensor.py @@ -1505,6 +1505,12 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = { suggested_display_precision=0, suggested_unit_of_measurement=UnitOfPower.WATT, ), + TuyaSensorEntityDescription( + key=DPCode.TEMP_CURRENT, + translation_key="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), ), # Pool HeatPump "znrb": ( diff --git a/tests/components/tuya/__init__.py b/tests/components/tuya/__init__.py index 32db4c9ad5f..246a4388c76 100644 --- a/tests/components/tuya/__init__.py +++ b/tests/components/tuya/__init__.py @@ -212,6 +212,7 @@ DEVICE_MOCKS = [ "zndb_4ggkyflayu1h1ho9", # https://github.com/home-assistant/core/pull/149317 "zndb_v5jlnn5hwyffkhp3", # https://github.com/home-assistant/core/issues/143209 "zndb_ze8faryrxr0glqnn", # https://github.com/home-assistant/core/issues/138372 + "znnbq_6b3pbbuqbfabhfiq", # https://github.com/orgs/home-assistant/discussions/707 "znrb_db81ge24jctwx8lo", # https://github.com/home-assistant/core/issues/136513 "zwjcy_myd45weu", # https://github.com/orgs/home-assistant/discussions/482 ] diff --git a/tests/components/tuya/fixtures/znnbq_6b3pbbuqbfabhfiq.json b/tests/components/tuya/fixtures/znnbq_6b3pbbuqbfabhfiq.json new file mode 100644 index 00000000000..597721599e3 --- /dev/null +++ b/tests/components/tuya/fixtures/znnbq_6b3pbbuqbfabhfiq.json @@ -0,0 +1,56 @@ +{ + "endpoint": "https://apigw.tuyaeu.com", + "mqtt_connected": true, + "disabled_by": null, + "disabled_polling": false, + "name": "Wi-Fi solar grid micro inverter \uff08GT\uff09", + "category": "znnbq", + "product_id": "6b3pbbuqbfabhfiq", + "product_name": "Wi-Fi solar grid micro inverter \uff08GT\uff09", + "online": true, + "sub": false, + "time_zone": "+02:00", + "active_time": "2025-08-18T16:19:32+00:00", + "create_time": "2025-08-18T16:19:32+00:00", + "update_time": "2025-08-18T16:19:32+00:00", + "function": {}, + "status_range": { + "reverse_energy_total": { + "type": "Integer", + "value": { + "unit": "kW\u00b7h", + "min": 0, + "max": 99999999, + "scale": 2, + "step": 1 + } + }, + "power_total": { + "type": "Integer", + "value": { + "unit": "kW", + "min": 0, + "max": 900000, + "scale": 3, + "step": 1 + } + }, + "temp_current": { + "type": "Integer", + "value": { + "unit": "\u2103", + "min": -500, + "max": 2000, + "scale": 1, + "step": 1 + } + } + }, + "status": { + "reverse_energy_total": 19, + "power_total": 0, + "temp_current": 219 + }, + "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 9af474f875d..5eb43abd365 100644 --- a/tests/components/tuya/snapshots/test_init.ambr +++ b/tests/components/tuya/snapshots/test_init.ambr @@ -4556,6 +4556,37 @@ 'via_device_id': None, }) # --- +# name: test_device_registry[qifhbafbqubbp3b6qbnnz] + 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', + 'qifhbafbqubbp3b6qbnnz', + ), + }), + 'labels': set({ + }), + 'manufacturer': 'Tuya', + 'model': 'Wi-Fi solar grid micro inverter (GT)', + 'model_id': '6b3pbbuqbfabhfiq', + 'name': 'Wi-Fi solar grid micro inverter (GT)', + 'name_by_user': None, + 'primary_config_entry': , + 'serial_number': None, + 'sw_version': None, + 'via_device_id': None, + }) +# --- # name: test_device_registry[queafegmhhmtivdxjd] DeviceRegistryEntrySnapshot({ 'area_id': None, diff --git a/tests/components/tuya/snapshots/test_sensor.ambr b/tests/components/tuya/snapshots/test_sensor.ambr index b2c0b92bd30..0baf85f05b6 100644 --- a/tests/components/tuya/snapshots/test_sensor.ambr +++ b/tests/components/tuya/snapshots/test_sensor.ambr @@ -13123,6 +13123,177 @@ 'state': 'unavailable', }) # --- +# name: test_platform_setup_and_discovery[sensor.wi_fi_solar_grid_micro_inverter_gt_power-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.wi_fi_solar_grid_micro_inverter_gt_power', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 0, + }), + 'sensor.private': dict({ + 'suggested_unit_of_measurement': , + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Power', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'power', + 'unique_id': 'tuya.qifhbafbqubbp3b6qbnnzpower_total', + 'unit_of_measurement': , + }) +# --- +# name: test_platform_setup_and_discovery[sensor.wi_fi_solar_grid_micro_inverter_gt_power-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'power', + 'friendly_name': 'Wi-Fi solar grid micro inverter (GT) Power', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.wi_fi_solar_grid_micro_inverter_gt_power', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0.0', + }) +# --- +# name: test_platform_setup_and_discovery[sensor.wi_fi_solar_grid_micro_inverter_gt_temperature-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.wi_fi_solar_grid_micro_inverter_gt_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Temperature', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature', + 'unique_id': 'tuya.qifhbafbqubbp3b6qbnnztemp_current', + 'unit_of_measurement': , + }) +# --- +# name: test_platform_setup_and_discovery[sensor.wi_fi_solar_grid_micro_inverter_gt_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Wi-Fi solar grid micro inverter (GT) Temperature', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.wi_fi_solar_grid_micro_inverter_gt_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '21.9', + }) +# --- +# name: test_platform_setup_and_discovery[sensor.wi_fi_solar_grid_micro_inverter_gt_total_energy-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.wi_fi_solar_grid_micro_inverter_gt_total_energy', + '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': 'Total energy', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'total_energy', + 'unique_id': 'tuya.qifhbafbqubbp3b6qbnnzreverse_energy_total', + 'unit_of_measurement': , + }) +# --- +# name: test_platform_setup_and_discovery[sensor.wi_fi_solar_grid_micro_inverter_gt_total_energy-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'energy', + 'friendly_name': 'Wi-Fi solar grid micro inverter (GT) Total energy', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.wi_fi_solar_grid_micro_inverter_gt_total_energy', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0.19', + }) +# --- # name: test_platform_setup_and_discovery[sensor.wifi_smart_gas_boiler_thermostat_battery-entry] EntityRegistryEntrySnapshot({ 'aliases': set({