From cd9339903fb0d85ff39ec71073cf82b6fc64fdd9 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Wed, 21 May 2025 21:17:03 +0200 Subject: [PATCH] Add thermostat fixture to SmartThings (#145407) --- tests/components/smartthings/conftest.py | 1 + .../device_status/sensi_thermostat.json | 106 ++++++++++++++++++ .../fixtures/devices/sensi_thermostat.json | 78 +++++++++++++ .../smartthings/snapshots/test_climate.ambr | 84 ++++++++++++++ .../smartthings/snapshots/test_init.ambr | 33 ++++++ .../smartthings/snapshots/test_sensor.ambr | 104 +++++++++++++++++ .../smartthings/snapshots/test_switch.ambr | 94 ++++++++-------- tests/components/smartthings/test_climate.py | 6 +- 8 files changed, 456 insertions(+), 50 deletions(-) create mode 100644 tests/components/smartthings/fixtures/device_status/sensi_thermostat.json create mode 100644 tests/components/smartthings/fixtures/devices/sensi_thermostat.json diff --git a/tests/components/smartthings/conftest.py b/tests/components/smartthings/conftest.py index ab6c6031d5e..e8cde67122b 100644 --- a/tests/components/smartthings/conftest.py +++ b/tests/components/smartthings/conftest.py @@ -146,6 +146,7 @@ def mock_smartthings() -> Generator[AsyncMock]: "ecobee_sensor", "ecobee_thermostat", "ecobee_thermostat_offline", + "sensi_thermostat", "fake_fan", "generic_fan_3_speed", "heatit_ztrm3_thermostat", diff --git a/tests/components/smartthings/fixtures/device_status/sensi_thermostat.json b/tests/components/smartthings/fixtures/device_status/sensi_thermostat.json new file mode 100644 index 00000000000..103e6631ab1 --- /dev/null +++ b/tests/components/smartthings/fixtures/device_status/sensi_thermostat.json @@ -0,0 +1,106 @@ +{ + "components": { + "main": { + "thermostatOperatingState": { + "supportedThermostatOperatingStates": { + "value": null + }, + "thermostatOperatingState": { + "value": "idle", + "timestamp": "2025-05-17T14:16:43.740Z" + } + }, + "relativeHumidityMeasurement": { + "humidity": { + "value": 49, + "unit": "%", + "timestamp": "2025-05-17T14:32:56.192Z" + } + }, + "healthCheck": { + "checkInterval": { + "value": 60, + "unit": "s", + "data": { + "deviceScheme": "UNTRACKED", + "protocol": "cloud" + }, + "timestamp": "2022-04-16T19:45:51.006Z" + }, + "healthStatus": { + "value": null + }, + "DeviceWatch-Enroll": { + "value": null + }, + "DeviceWatch-DeviceStatus": { + "value": "online", + "data": {}, + "timestamp": "2025-05-17T14:16:10.555Z" + } + }, + "temperatureMeasurement": { + "temperatureRange": { + "value": null + }, + "temperature": { + "value": 74.5, + "unit": "F", + "timestamp": "2025-05-17T14:32:56.192Z" + } + }, + "thermostatHeatingSetpoint": { + "heatingSetpoint": { + "value": 71, + "unit": "F", + "timestamp": "2025-05-17T14:16:12.093Z" + }, + "heatingSetpointRange": { + "value": null + } + }, + "thermostatFanMode": { + "thermostatFanMode": { + "value": "auto", + "data": { + "supportedThermostatFanModes": ["auto", "on", "circulate"] + }, + "timestamp": "2025-05-17T03:45:45.413Z" + }, + "supportedThermostatFanModes": { + "value": ["auto", "on", "circulate"], + "timestamp": "2025-05-17T03:45:45.413Z" + } + }, + "thermostatMode": { + "thermostatMode": { + "value": "auto", + "data": { + "supportedThermostatModes": [ + "off", + "heat", + "cool", + "emergency heat", + "auto" + ] + }, + "timestamp": "2025-05-17T05:45:53.597Z" + }, + "supportedThermostatModes": { + "value": ["off", "heat", "cool", "emergency heat", "auto"], + "timestamp": "2025-05-17T03:45:45.413Z" + } + }, + "thermostatCoolingSetpoint": { + "coolingSetpointRange": { + "value": null + }, + "coolingSetpoint": { + "value": 75, + "unit": "F", + "timestamp": "2025-05-17T14:16:13.677Z" + } + } + } + } +} diff --git a/tests/components/smartthings/fixtures/devices/sensi_thermostat.json b/tests/components/smartthings/fixtures/devices/sensi_thermostat.json new file mode 100644 index 00000000000..48d2a9c093d --- /dev/null +++ b/tests/components/smartthings/fixtures/devices/sensi_thermostat.json @@ -0,0 +1,78 @@ +{ + "items": [ + { + "deviceId": "2409a73c-918a-4d1f-b4f5-c27468c71d70", + "name": "Sensi Thermostat", + "label": "Thermostat", + "manufacturerName": "0AKf", + "presentationId": "sensi_thermostat", + "deviceManufacturerCode": "Emerson", + "locationId": "fc2fb744-4d34-4276-be33-56bbc6af266e", + "ownerId": "aecdb855-3ab7-9305-c0e3-0dced524e5dc", + "roomId": "025f6d30-c16c-4d11-8be2-03d5f4708d86", + "components": [ + { + "id": "main", + "label": "main", + "capabilities": [ + { + "id": "temperatureMeasurement", + "version": 1 + }, + { + "id": "thermostatCoolingSetpoint", + "version": 1 + }, + { + "id": "thermostatHeatingSetpoint", + "version": 1 + }, + { + "id": "thermostatOperatingState", + "version": 1 + }, + { + "id": "thermostatMode", + "version": 1 + }, + { + "id": "thermostatFanMode", + "version": 1 + }, + { + "id": "relativeHumidityMeasurement", + "version": 1 + }, + { + "id": "healthCheck", + "version": 1 + } + ], + "categories": [ + { + "name": "Thermostat", + "categoryType": "manufacturer" + } + ], + "optional": false + } + ], + "createTime": "2022-04-16T19:45:50.864Z", + "profile": { + "id": "923a86cc-983f-4cb1-98da-64fb5aa435ca" + }, + "viper": { + "manufacturerName": "Emerson", + "modelName": "1F95U-42WF", + "swVersion": "6004971003", + "endpointAppId": "viper_7722c3c0-dfc1-11e9-9149-4f2618178093" + }, + "type": "VIPER", + "restrictionTier": 0, + "allowed": null, + "executionContext": "CLOUD", + "relationships": [] + } + ], + "_links": {} +} diff --git a/tests/components/smartthings/snapshots/test_climate.ambr b/tests/components/smartthings/snapshots/test_climate.ambr index 6f4dd67d7f7..aef51b1c866 100644 --- a/tests/components/smartthings/snapshots/test_climate.ambr +++ b/tests/components/smartthings/snapshots/test_climate.ambr @@ -797,6 +797,90 @@ 'state': 'heat', }) # --- +# name: test_all_entities[sensi_thermostat][climate.thermostat-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'fan_modes': list([ + 'auto', + 'on', + 'circulate', + ]), + 'hvac_modes': list([ + , + , + , + , + , + ]), + 'max_temp': 35.0, + 'min_temp': 7.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'climate', + 'entity_category': None, + 'entity_id': 'climate.thermostat', + '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': 'smartthings', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '2409a73c-918a-4d1f-b4f5-c27468c71d70_main', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[sensi_thermostat][climate.thermostat-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'current_humidity': 49, + 'current_temperature': 23.6, + 'fan_mode': 'auto', + 'fan_modes': list([ + 'auto', + 'on', + 'circulate', + ]), + 'friendly_name': 'Thermostat', + 'hvac_action': , + 'hvac_modes': list([ + , + , + , + , + , + ]), + 'max_temp': 35.0, + 'min_temp': 7.0, + 'supported_features': , + 'target_temp_high': 23.9, + 'target_temp_low': 21.7, + 'temperature': None, + }), + 'context': , + 'entity_id': 'climate.thermostat', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'heat_cool', + }) +# --- # name: test_all_entities[virtual_thermostat][climate.asd-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ diff --git a/tests/components/smartthings/snapshots/test_init.ambr b/tests/components/smartthings/snapshots/test_init.ambr index 58b89099b11..446eca63fb2 100644 --- a/tests/components/smartthings/snapshots/test_init.ambr +++ b/tests/components/smartthings/snapshots/test_init.ambr @@ -1751,6 +1751,39 @@ 'via_device_id': None, }) # --- +# name: test_devices[sensi_thermostat] + 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', + '2409a73c-918a-4d1f-b4f5-c27468c71d70', + ), + }), + 'is_new': False, + 'labels': set({ + }), + 'manufacturer': 'Emerson', + 'model': '1F95U-42WF', + 'model_id': None, + 'name': 'Thermostat', + 'name_by_user': None, + 'primary_config_entry': , + 'serial_number': None, + 'suggested_area': None, + 'sw_version': '6004971003', + 'via_device_id': None, + }) +# --- # name: test_devices[sensibo_airconditioner_1] DeviceRegistryEntrySnapshot({ 'area_id': None, diff --git a/tests/components/smartthings/snapshots/test_sensor.ambr b/tests/components/smartthings/snapshots/test_sensor.ambr index f5fe09cc4d5..7e9dd5c08da 100644 --- a/tests/components/smartthings/snapshots/test_sensor.ambr +++ b/tests/components/smartthings/snapshots/test_sensor.ambr @@ -11327,6 +11327,110 @@ 'state': '-1042', }) # --- +# name: test_all_entities[sensi_thermostat][sensor.thermostat_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.thermostat_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, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '2409a73c-918a-4d1f-b4f5-c27468c71d70_main_relativeHumidityMeasurement_humidity_humidity', + 'unit_of_measurement': '%', + }) +# --- +# name: test_all_entities[sensi_thermostat][sensor.thermostat_humidity-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'humidity', + 'friendly_name': 'Thermostat Humidity', + 'state_class': , + 'unit_of_measurement': '%', + }), + 'context': , + 'entity_id': 'sensor.thermostat_humidity', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '49', + }) +# --- +# name: test_all_entities[sensi_thermostat][sensor.thermostat_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.thermostat_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Temperature', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '2409a73c-918a-4d1f-b4f5-c27468c71d70_main_temperatureMeasurement_temperature_temperature', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[sensi_thermostat][sensor.thermostat_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Thermostat Temperature', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.thermostat_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '23.6', + }) +# --- # name: test_all_entities[sensibo_airconditioner_1][sensor.office_air_conditioner_mode-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ diff --git a/tests/components/smartthings/snapshots/test_switch.ambr b/tests/components/smartthings/snapshots/test_switch.ambr index 6d0be8b3c89..3b5aa4114ea 100644 --- a/tests/components/smartthings/snapshots/test_switch.ambr +++ b/tests/components/smartthings/snapshots/test_switch.ambr @@ -516,53 +516,6 @@ 'state': 'off', }) # --- -# name: test_all_entities[da_wm_sc_000001][switch.airdresser_sanitize-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.airdresser_sanitize', - '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': 'Sanitize', - 'platform': 'smartthings', - 'previous_unique_id': None, - 'supported_features': 0, - 'translation_key': 'sanitize', - 'unique_id': 'b93211bf-9d96-bd21-3b2f-964fcc87f5cc_main_samsungce.steamClosetSanitizeMode_status_status', - 'unit_of_measurement': None, - }) -# --- -# name: test_all_entities[da_wm_sc_000001][switch.airdresser_sanitize-state] - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'AirDresser Sanitize', - }), - 'context': , - 'entity_id': 'switch.airdresser_sanitize', - 'last_changed': , - 'last_reported': , - 'last_updated': , - 'state': 'off', - }) -# --- # name: test_all_entities[da_wm_sc_000001][switch.airdresser_auto_cycle_link-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ @@ -657,6 +610,53 @@ 'state': 'off', }) # --- +# name: test_all_entities[da_wm_sc_000001][switch.airdresser_sanitize-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.airdresser_sanitize', + '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': 'Sanitize', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'sanitize', + 'unique_id': 'b93211bf-9d96-bd21-3b2f-964fcc87f5cc_main_samsungce.steamClosetSanitizeMode_status_status', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[da_wm_sc_000001][switch.airdresser_sanitize-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'AirDresser Sanitize', + }), + 'context': , + 'entity_id': 'switch.airdresser_sanitize', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- # name: test_all_entities[da_wm_wd_000001][switch.dryer_wrinkle_prevent-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ diff --git a/tests/components/smartthings/test_climate.py b/tests/components/smartthings/test_climate.py index ff8b5277e20..6332fbf905f 100644 --- a/tests/components/smartthings/test_climate.py +++ b/tests/components/smartthings/test_climate.py @@ -613,7 +613,7 @@ async def test_thermostat_set_fan_mode( ) -@pytest.mark.parametrize("device_fixture", ["virtual_thermostat"]) +@pytest.mark.parametrize("device_fixture", ["sensi_thermostat"]) async def test_thermostat_set_hvac_mode( hass: HomeAssistant, devices: AsyncMock, @@ -625,11 +625,11 @@ async def test_thermostat_set_hvac_mode( await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_SET_HVAC_MODE, - {ATTR_ENTITY_ID: "climate.asd", ATTR_HVAC_MODE: HVACMode.HEAT_COOL}, + {ATTR_ENTITY_ID: "climate.thermostat", ATTR_HVAC_MODE: HVACMode.HEAT_COOL}, blocking=True, ) devices.execute_device_command.assert_called_once_with( - "2894dc93-0f11-49cc-8a81-3a684cebebf6", + "2409a73c-918a-4d1f-b4f5-c27468c71d70", Capability.THERMOSTAT_MODE, Command.SET_THERMOSTAT_MODE, MAIN,