Check support for thermostat operating state in SmartThings (#140103)

This commit is contained in:
Joost Lekkerkerker 2025-03-08 11:22:09 +01:00 committed by Franck Nijhof
parent 7336c8fc07
commit faf9977abb
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
7 changed files with 391 additions and 0 deletions

View File

@ -251,6 +251,8 @@ class SmartThingsThermostat(SmartThingsEntity, ClimateEntity):
@property
def hvac_action(self) -> HVACAction | None:
"""Return the current running hvac operation if supported."""
if not self.supports_capability(Capability.THERMOSTAT_OPERATING_STATE):
return None
return OPERATING_STATE_TO_ACTION.get(
self.get_attribute_value(
Capability.THERMOSTAT_OPERATING_STATE,

View File

@ -118,6 +118,7 @@ def mock_smartthings() -> Generator[AsyncMock]:
"fake_fan",
"generic_fan_3_speed",
"heatit_ztrm3_thermostat",
"bosch_radiator_thermostat_ii",
]
)
def device_fixture(

View File

@ -0,0 +1,89 @@
{
"components": {
"main": {
"temperatureMeasurement": {
"temperatureRange": {
"value": null
},
"temperature": {
"value": 23.9,
"unit": "C",
"timestamp": "2025-03-07T19:55:13.328Z"
}
},
"thermostatHeatingSetpoint": {
"heatingSetpoint": {
"value": 22.0,
"unit": "C",
"timestamp": "2025-03-05T03:05:26.510Z"
},
"heatingSetpointRange": {
"value": {
"minimum": 5.0,
"maximum": 40.0,
"step": 0.1
},
"unit": "C",
"timestamp": "2025-03-05T03:05:26.510Z"
}
},
"refresh": {},
"thermostatMode": {
"thermostatMode": {
"value": "heat",
"data": {
"supportedThermostatModes": ["off", "heat"]
},
"timestamp": "2025-03-05T03:05:26.489Z"
},
"supportedThermostatModes": {
"value": ["off", "heat"],
"timestamp": "2025-03-05T03:05:26.509Z"
}
},
"battery": {
"quantity": {
"value": null
},
"battery": {
"value": 94,
"unit": "%",
"timestamp": "2025-03-07T20:47:27.362Z"
},
"type": {
"value": null
}
},
"firmwareUpdate": {
"lastUpdateStatusReason": {
"value": null
},
"availableVersion": {
"value": "2.00.09 (20009)",
"timestamp": "2024-11-29T19:55:02.005Z"
},
"lastUpdateStatus": {
"value": null
},
"supportedCommands": {
"value": null
},
"state": {
"value": "normalOperation",
"timestamp": "2024-11-29T19:55:02.009Z"
},
"updateAvailable": {
"value": false,
"timestamp": "2024-11-29T19:55:02.004Z"
},
"currentVersion": {
"value": "2.00.09 (20009)",
"timestamp": "2024-11-29T19:55:02.037Z"
},
"lastUpdateTime": {
"value": null
}
}
}
}
}

View File

@ -0,0 +1,102 @@
{
"items": [
{
"deviceId": "286ba274-4093-4bcb-849c-a1a3efe7b1e5",
"name": "thermostat",
"label": "Radiator Thermostat II [+M] Wohnzimmer",
"manufacturerName": "SmartThingsCommunity",
"presentationId": "2a1c9915-f61b-3f3a-a02b-703b8cccf3d6",
"deviceManufacturerCode": "BOSCH",
"locationId": "0b6618a6-c3ab-4b6e-968d-59cc8c2761bc",
"ownerId": "8a20b799-9d87-ecdc-39de-c93c6e4d3ea1",
"roomId": "11374ab5-9b4e-416b-91d1-745bbf9b6db4",
"components": [
{
"id": "main",
"label": "main",
"capabilities": [
{
"id": "temperatureMeasurement",
"version": 1
},
{
"id": "thermostatMode",
"version": 1
},
{
"id": "thermostatHeatingSetpoint",
"version": 1
},
{
"id": "battery",
"version": 1
},
{
"id": "firmwareUpdate",
"version": 1
},
{
"id": "refresh",
"version": 1
}
],
"categories": [
{
"name": "Thermostat",
"categoryType": "manufacturer"
}
]
}
],
"createTime": "2024-11-29T19:55:00.910Z",
"parentDeviceId": "61bd280e-71c4-44fb-9b6e-53fdf14718a2",
"profile": {
"id": "4da5d086-111e-3084-a039-616974326833"
},
"matter": {
"driverId": "5f3c42eb-5704-4c95-9705-c51c1a6764bf",
"hubId": "61bd280e-71c4-44fb-9b6e-53fdf14718a2",
"provisioningState": "PROVISIONED",
"networkId": "8EF2CF7A212285B2-46C6B9F266A4521A",
"executingLocally": true,
"uniqueId": "8475B3FEFF6748D4",
"vendorId": 4617,
"productId": 12306,
"serialNumber": "D44867FFFEB37584",
"listeningType": "SLEEPY",
"supportedNetworkInterfaces": ["THREAD"],
"version": {
"hardware": 18,
"hardwareLabel": "1.2.0",
"software": 20009,
"softwareLabel": "2.00.09"
},
"endpoints": [
{
"endpointId": 0,
"deviceTypes": [
{
"deviceTypeId": 22
}
]
},
{
"endpointId": 1,
"deviceTypes": [
{
"deviceTypeId": 769
}
]
}
],
"syncDrivers": true
},
"type": "MATTER",
"restrictionTier": 0,
"allowed": null,
"executionContext": "LOCAL",
"relationships": []
}
],
"_links": {}
}

View File

@ -1,4 +1,67 @@
# serializer version: 1
# name: test_all_entities[bosch_radiator_thermostat_ii][climate.radiator_thermostat_ii_m_wohnzimmer-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'hvac_modes': list([
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 35,
'min_temp': 7,
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'climate',
'entity_category': None,
'entity_id': 'climate.radiator_thermostat_ii_m_wohnzimmer',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': <ClimateEntityFeature: 387>,
'translation_key': None,
'unique_id': '286ba274-4093-4bcb-849c-a1a3efe7b1e5',
'unit_of_measurement': None,
})
# ---
# name: test_all_entities[bosch_radiator_thermostat_ii][climate.radiator_thermostat_ii_m_wohnzimmer-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 23.9,
'friendly_name': 'Radiator Thermostat II [+M] Wohnzimmer',
'hvac_modes': list([
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 35,
'min_temp': 7,
'supported_features': <ClimateEntityFeature: 387>,
'target_temp_high': None,
'target_temp_low': None,
'temperature': 22.0,
}),
'context': <ANY>,
'entity_id': 'climate.radiator_thermostat_ii_m_wohnzimmer',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'heat',
})
# ---
# name: test_all_entities[da_ac_rac_000001][climate.ac_office_granit-entry]
EntityRegistryEntrySnapshot({
'aliases': set({

View File

@ -68,6 +68,39 @@
'via_device_id': None,
})
# ---
# name: test_devices[bosch_radiator_thermostat_ii]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'config_entries_subentries': <ANY>,
'configuration_url': 'https://account.smartthings.com',
'connections': set({
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'smartthings',
'286ba274-4093-4bcb-849c-a1a3efe7b1e5',
),
}),
'is_new': False,
'labels': set({
}),
'manufacturer': None,
'model': None,
'model_id': None,
'name': 'Radiator Thermostat II [+M] Wohnzimmer',
'name_by_user': None,
'primary_config_entry': <ANY>,
'serial_number': None,
'suggested_area': None,
'sw_version': None,
'via_device_id': None,
})
# ---
# name: test_devices[c2c_arlo_pro_3_switch]
DeviceRegistryEntrySnapshot({
'area_id': None,

View File

@ -258,6 +258,107 @@
'state': '938.3',
})
# ---
# name: test_all_entities[bosch_radiator_thermostat_ii][sensor.radiator_thermostat_ii_m_wohnzimmer_battery-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'sensor.radiator_thermostat_ii_m_wohnzimmer_battery',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.BATTERY: 'battery'>,
'original_icon': None,
'original_name': 'Battery',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': '286ba274-4093-4bcb-849c-a1a3efe7b1e5.battery',
'unit_of_measurement': '%',
})
# ---
# name: test_all_entities[bosch_radiator_thermostat_ii][sensor.radiator_thermostat_ii_m_wohnzimmer_battery-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'battery',
'friendly_name': 'Radiator Thermostat II [+M] Wohnzimmer Battery',
'unit_of_measurement': '%',
}),
'context': <ANY>,
'entity_id': 'sensor.radiator_thermostat_ii_m_wohnzimmer_battery',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '94',
})
# ---
# name: test_all_entities[bosch_radiator_thermostat_ii][sensor.radiator_thermostat_ii_m_wohnzimmer_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.radiator_thermostat_ii_m_wohnzimmer_temperature',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.TEMPERATURE: 'temperature'>,
'original_icon': None,
'original_name': 'Temperature',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': '286ba274-4093-4bcb-849c-a1a3efe7b1e5.temperature',
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
})
# ---
# name: test_all_entities[bosch_radiator_thermostat_ii][sensor.radiator_thermostat_ii_m_wohnzimmer_temperature-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'temperature',
'friendly_name': 'Radiator Thermostat II [+M] Wohnzimmer Temperature',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,
'entity_id': 'sensor.radiator_thermostat_ii_m_wohnzimmer_temperature',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '23.9',
})
# ---
# name: test_all_entities[c2c_arlo_pro_3_switch][sensor.2nd_floor_hallway_alarm-entry]
EntityRegistryEntrySnapshot({
'aliases': set({