diff --git a/homeassistant/components/smartthings/sensor.py b/homeassistant/components/smartthings/sensor.py index a38331d6aed..d3e2ab09a3f 100644 --- a/homeassistant/components/smartthings/sensor.py +++ b/homeassistant/components/smartthings/sensor.py @@ -476,6 +476,16 @@ CAPABILITY_TO_SENSORS: dict[ ) ] }, + Capability.FINE_DUST_SENSOR: { + Attribute.FINE_DUST_LEVEL: [ + SmartThingsSensorEntityDescription( + key=Attribute.FINE_DUST_LEVEL, + native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + state_class=SensorStateClass.MEASUREMENT, + device_class=SensorDeviceClass.PM25, + ) + ] + }, # Haven't seen at devices yet Capability.FORMALDEHYDE_MEASUREMENT: { Attribute.FORMALDEHYDE_LEVEL: [ diff --git a/tests/components/smartthings/conftest.py b/tests/components/smartthings/conftest.py index 9a633a38f1a..f13617d64d5 100644 --- a/tests/components/smartthings/conftest.py +++ b/tests/components/smartthings/conftest.py @@ -96,6 +96,7 @@ def mock_smartthings() -> Generator[AsyncMock]: @pytest.fixture( params=[ + "aq_sensor_3_ikea", "da_ac_airsensor_01001", "da_ac_rac_000001", "da_ac_rac_000003", diff --git a/tests/components/smartthings/fixtures/device_status/aq_sensor_3_ikea.json b/tests/components/smartthings/fixtures/device_status/aq_sensor_3_ikea.json new file mode 100644 index 00000000000..383c5d1e85e --- /dev/null +++ b/tests/components/smartthings/fixtures/device_status/aq_sensor_3_ikea.json @@ -0,0 +1,94 @@ +{ + "components": { + "main": { + "tvocMeasurement": { + "tvocLevel": { + "value": 0.1, + "unit": "ppm", + "timestamp": "2025-08-15T13:48:52.222Z" + } + }, + "fineDustSensor": { + "fineDustLevel": { + "value": 1, + "unit": "\u03bcg/m^3", + "timestamp": "2025-08-15T13:29:36.938Z" + } + }, + "relativeHumidityMeasurement": { + "humidity": { + "value": 53.0, + "unit": "%", + "timestamp": "2025-08-15T13:48:42.554Z" + } + }, + "temperatureMeasurement": { + "temperatureRange": { + "value": { + "minimum": -10.0, + "maximum": 50.0 + }, + "unit": "C", + "timestamp": "2025-03-19T19:48:47.896Z" + }, + "temperature": { + "value": 22.0, + "unit": "C", + "timestamp": "2025-08-15T12:25:37.127Z" + } + }, + "refresh": {}, + "airQualityHealthConcern": { + "supportedAirQualityValues": { + "value": null + }, + "airQualityHealthConcern": { + "value": "good", + "timestamp": "2025-08-15T13:17:38.791Z" + } + }, + "firmwareUpdate": { + "lastUpdateStatusReason": { + "value": "TOO_MANY_CLIENTS", + "timestamp": "2025-06-09T05:59:52.076Z" + }, + "imageTransferProgress": { + "value": null + }, + "availableVersion": { + "value": "00010010", + "timestamp": "2025-03-19T19:49:07.016Z" + }, + "lastUpdateStatus": { + "value": "updateFailed", + "timestamp": "2025-06-09T05:59:52.072Z" + }, + "supportedCommands": { + "value": null + }, + "state": { + "value": "normalOperation", + "timestamp": "2025-06-09T05:59:52.105Z" + }, + "estimatedTimeRemaining": { + "value": null + }, + "updateAvailable": { + "value": false, + "timestamp": "2025-03-19T19:49:07.014Z" + }, + "currentVersion": { + "value": "00010010", + "timestamp": "2025-06-09T05:59:52.071Z" + }, + "lastUpdateTime": { + "value": "2025-06-09T05:59:51Z", + "timestamp": "2025-06-09T05:59:52.076Z" + }, + "supportsProgressReports": { + "value": null + } + } + } + } +} diff --git a/tests/components/smartthings/fixtures/devices/aq_sensor_3_ikea.json b/tests/components/smartthings/fixtures/devices/aq_sensor_3_ikea.json new file mode 100644 index 00000000000..dc4c4821587 --- /dev/null +++ b/tests/components/smartthings/fixtures/devices/aq_sensor_3_ikea.json @@ -0,0 +1,77 @@ +{ + "items": [ + { + "deviceId": "e44d4e5c-45ea-498f-a653-f5d0c3d97bb8", + "name": "humidity-temp-dust-tvoc", + "label": "aq-sensor-3-ikea", + "manufacturerName": "SmartThingsCommunity", + "presentationId": "a39f5e57-c861-3904-9567-acda80b7cf2d", + "deviceManufacturerCode": "IKEA of Sweden", + "locationId": "9fbc89a0-5c32-494d-9a49-68186d6a5387", + "ownerId": "d051c4c5-8ccb-47b9-87ee-7ebb99694b9f", + "roomId": "f5ce3177-e0a6-4415-8496-bafa1611ee62", + "components": [ + { + "id": "main", + "label": "main", + "capabilities": [ + { + "id": "temperatureMeasurement", + "version": 1 + }, + { + "id": "relativeHumidityMeasurement", + "version": 1 + }, + { + "id": "fineDustSensor", + "version": 1 + }, + { + "id": "airQualityHealthConcern", + "version": 1 + }, + { + "id": "tvocMeasurement", + "version": 1 + }, + { + "id": "firmwareUpdate", + "version": 1 + }, + { + "id": "refresh", + "version": 1 + } + ], + "categories": [ + { + "name": "AirQualityDetector", + "categoryType": "manufacturer" + } + ], + "optional": false + } + ], + "createTime": "2025-03-19T19:48:39.571Z", + "parentDeviceId": "5616f552-5bae-4a1f-94b3-9eb2673a1b28", + "profile": { + "id": "0720a973-6923-39d4-8991-3aaed6edf5d5" + }, + "zigbee": { + "eui": "0CAE5FFFFECE4328", + "networkId": "846B", + "driverId": "9bee78b3-204e-4118-8265-8767f9152c49", + "executingLocally": true, + "hubId": "5616f552-5bae-4a1f-94b3-9eb2673a1b28", + "provisioningState": "PROVISIONED" + }, + "type": "ZIGBEE", + "restrictionTier": 0, + "allowed": null, + "executionContext": "LOCAL", + "relationships": [] + } + ], + "_links": {} +} diff --git a/tests/components/smartthings/snapshots/test_init.ambr b/tests/components/smartthings/snapshots/test_init.ambr index 5fd7040f61b..d732578212a 100644 --- a/tests/components/smartthings/snapshots/test_init.ambr +++ b/tests/components/smartthings/snapshots/test_init.ambr @@ -64,6 +64,37 @@ 'via_device_id': None, }) # --- +# name: test_devices[aq_sensor_3_ikea] + DeviceRegistryEntrySnapshot({ + 'area_id': None, + 'config_entries': , + 'config_entries_subentries': , + 'configuration_url': 'https://account.smartthings.com', + 'connections': set({ + }), + 'disabled_by': None, + 'entry_type': None, + 'hw_version': None, + 'id': , + 'identifiers': set({ + tuple( + 'smartthings', + 'e44d4e5c-45ea-498f-a653-f5d0c3d97bb8', + ), + }), + 'labels': set({ + }), + 'manufacturer': None, + 'model': None, + 'model_id': None, + 'name': 'aq-sensor-3-ikea', + 'name_by_user': None, + 'primary_config_entry': , + 'serial_number': None, + 'sw_version': None, + 'via_device_id': None, + }) +# --- # name: test_devices[aux_ac] DeviceRegistryEntrySnapshot({ 'area_id': None, diff --git a/tests/components/smartthings/snapshots/test_sensor.ambr b/tests/components/smartthings/snapshots/test_sensor.ambr index 8771ed505cf..dfc738bf7d7 100644 --- a/tests/components/smartthings/snapshots/test_sensor.ambr +++ b/tests/components/smartthings/snapshots/test_sensor.ambr @@ -163,6 +163,221 @@ 'state': 'unknown', }) # --- +# name: test_all_entities[aq_sensor_3_ikea][sensor.aq_sensor_3_ikea_humidity-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.aq_sensor_3_ikea_humidity', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Humidity', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'e44d4e5c-45ea-498f-a653-f5d0c3d97bb8_main_relativeHumidityMeasurement_humidity_humidity', + 'unit_of_measurement': '%', + }) +# --- +# name: test_all_entities[aq_sensor_3_ikea][sensor.aq_sensor_3_ikea_humidity-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'humidity', + 'friendly_name': 'aq-sensor-3-ikea Humidity', + 'state_class': , + 'unit_of_measurement': '%', + }), + 'context': , + 'entity_id': 'sensor.aq_sensor_3_ikea_humidity', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '53.0', + }) +# --- +# name: test_all_entities[aq_sensor_3_ikea][sensor.aq_sensor_3_ikea_pm2_5-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.aq_sensor_3_ikea_pm2_5', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'PM2.5', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'e44d4e5c-45ea-498f-a653-f5d0c3d97bb8_main_fineDustSensor_fineDustLevel_fineDustLevel', + 'unit_of_measurement': 'µg/m³', + }) +# --- +# name: test_all_entities[aq_sensor_3_ikea][sensor.aq_sensor_3_ikea_pm2_5-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'pm25', + 'friendly_name': 'aq-sensor-3-ikea PM2.5', + 'state_class': , + 'unit_of_measurement': 'µg/m³', + }), + 'context': , + 'entity_id': 'sensor.aq_sensor_3_ikea_pm2_5', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '1', + }) +# --- +# name: test_all_entities[aq_sensor_3_ikea][sensor.aq_sensor_3_ikea_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.aq_sensor_3_ikea_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': 'smartthings', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'e44d4e5c-45ea-498f-a653-f5d0c3d97bb8_main_temperatureMeasurement_temperature_temperature', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[aq_sensor_3_ikea][sensor.aq_sensor_3_ikea_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'aq-sensor-3-ikea Temperature', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.aq_sensor_3_ikea_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '22.0', + }) +# --- +# name: test_all_entities[aq_sensor_3_ikea][sensor.aq_sensor_3_ikea_volatile_organic_compounds_parts-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.aq_sensor_3_ikea_volatile_organic_compounds_parts', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Volatile organic compounds parts', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'e44d4e5c-45ea-498f-a653-f5d0c3d97bb8_main_tvocMeasurement_tvocLevel_tvocLevel', + 'unit_of_measurement': 'ppm', + }) +# --- +# name: test_all_entities[aq_sensor_3_ikea][sensor.aq_sensor_3_ikea_volatile_organic_compounds_parts-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'volatile_organic_compounds_parts', + 'friendly_name': 'aq-sensor-3-ikea Volatile organic compounds parts', + 'state_class': , + 'unit_of_measurement': 'ppm', + }), + 'context': , + 'entity_id': 'sensor.aq_sensor_3_ikea_volatile_organic_compounds_parts', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0.1', + }) +# --- # name: test_all_entities[aux_ac][sensor.aux_a_c_on_off_temperature-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ diff --git a/tests/components/smartthings/snapshots/test_update.ambr b/tests/components/smartthings/snapshots/test_update.ambr index 3191411a429..eb6b99b3363 100644 --- a/tests/components/smartthings/snapshots/test_update.ambr +++ b/tests/components/smartthings/snapshots/test_update.ambr @@ -1,4 +1,65 @@ # serializer version: 1 +# name: test_all_entities[aq_sensor_3_ikea][update.aq_sensor_3_ikea_firmware-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'update', + 'entity_category': , + 'entity_id': 'update.aq_sensor_3_ikea_firmware', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Firmware', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': 'e44d4e5c-45ea-498f-a653-f5d0c3d97bb8_main', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[aq_sensor_3_ikea][update.aq_sensor_3_ikea_firmware-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'auto_update': False, + 'device_class': 'firmware', + 'display_precision': 0, + 'entity_picture': 'https://brands.home-assistant.io/_/smartthings/icon.png', + 'friendly_name': 'aq-sensor-3-ikea Firmware', + 'in_progress': False, + 'installed_version': '00010010', + 'latest_version': '00010010', + 'release_summary': None, + 'release_url': None, + 'skipped_version': None, + 'supported_features': , + 'title': None, + 'update_percentage': None, + }), + 'context': , + 'entity_id': 'update.aq_sensor_3_ikea_firmware', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- # name: test_all_entities[bosch_radiator_thermostat_ii][update.radiator_thermostat_ii_m_wohnzimmer_firmware-entry] EntityRegistryEntrySnapshot({ 'aliases': set({