mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Add athmospheric pressure capability to SmartThings (#145103)
This commit is contained in:
parent
9ff9d9230e
commit
a3aae68229
@ -26,6 +26,7 @@ from homeassistant.const import (
|
|||||||
UnitOfEnergy,
|
UnitOfEnergy,
|
||||||
UnitOfMass,
|
UnitOfMass,
|
||||||
UnitOfPower,
|
UnitOfPower,
|
||||||
|
UnitOfPressure,
|
||||||
UnitOfTemperature,
|
UnitOfTemperature,
|
||||||
UnitOfVolume,
|
UnitOfVolume,
|
||||||
)
|
)
|
||||||
@ -200,6 +201,15 @@ CAPABILITY_TO_SENSORS: dict[
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
Capability.ATMOSPHERIC_PRESSURE_MEASUREMENT: {
|
||||||
|
Attribute.ATMOSPHERIC_PRESSURE: [
|
||||||
|
SmartThingsSensorEntityDescription(
|
||||||
|
key=Attribute.ATMOSPHERIC_PRESSURE,
|
||||||
|
device_class=SensorDeviceClass.ATMOSPHERIC_PRESSURE,
|
||||||
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
)
|
||||||
|
]
|
||||||
|
},
|
||||||
Capability.AUDIO_VOLUME: {
|
Capability.AUDIO_VOLUME: {
|
||||||
Attribute.VOLUME: [
|
Attribute.VOLUME: [
|
||||||
SmartThingsSensorEntityDescription(
|
SmartThingsSensorEntityDescription(
|
||||||
@ -1071,6 +1081,7 @@ UNITS = {
|
|||||||
"lux": LIGHT_LUX,
|
"lux": LIGHT_LUX,
|
||||||
"mG": None,
|
"mG": None,
|
||||||
"μg/m^3": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
"μg/m^3": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
|
"kPa": UnitOfPressure.KPA,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,6 +160,7 @@ def mock_smartthings() -> Generator[AsyncMock]:
|
|||||||
"aux_ac",
|
"aux_ac",
|
||||||
"hw_q80r_soundbar",
|
"hw_q80r_soundbar",
|
||||||
"gas_meter",
|
"gas_meter",
|
||||||
|
"lumi",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
def device_fixture(
|
def device_fixture(
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"components": {
|
||||||
|
"main": {
|
||||||
|
"configuration": {},
|
||||||
|
"relativeHumidityMeasurement": {
|
||||||
|
"humidity": {
|
||||||
|
"value": 27.24,
|
||||||
|
"unit": "%",
|
||||||
|
"timestamp": "2025-05-11T23:31:11.979Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"temperatureMeasurement": {
|
||||||
|
"temperatureRange": {
|
||||||
|
"value": {
|
||||||
|
"minimum": -58.0,
|
||||||
|
"maximum": 482.0
|
||||||
|
},
|
||||||
|
"unit": "F",
|
||||||
|
"timestamp": "2025-05-07T14:34:47.868Z"
|
||||||
|
},
|
||||||
|
"temperature": {
|
||||||
|
"value": 76.0,
|
||||||
|
"unit": "F",
|
||||||
|
"timestamp": "2025-05-11T23:31:11.904Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"atmosphericPressureMeasurement": {
|
||||||
|
"atmosphericPressure": {
|
||||||
|
"value": 100,
|
||||||
|
"unit": "kPa",
|
||||||
|
"timestamp": "2025-05-11T23:31:11.979Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"battery": {
|
||||||
|
"quantity": {
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"battery": {
|
||||||
|
"value": 100,
|
||||||
|
"unit": "%",
|
||||||
|
"timestamp": "2025-05-11T23:11:16.463Z"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"legendabsolute60149.atmosPressure": {
|
||||||
|
"atmosPressure": {
|
||||||
|
"value": 1004,
|
||||||
|
"unit": "mBar",
|
||||||
|
"timestamp": "2025-05-11T23:31:11.979Z"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
75
tests/components/smartthings/fixtures/devices/lumi.json
Normal file
75
tests/components/smartthings/fixtures/devices/lumi.json
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"deviceId": "692ea4e9-2022-4ed8-8a57-1b884a59cc38",
|
||||||
|
"name": "temp-humid-press-therm-battery-05",
|
||||||
|
"label": "Outdoor Temp",
|
||||||
|
"manufacturerName": "SmartThingsCommunity",
|
||||||
|
"presentationId": "cea6ca21-a702-3c43-8fe5-a7872c7a963f",
|
||||||
|
"deviceManufacturerCode": "LUMI",
|
||||||
|
"locationId": "96fe7a00-c7f6-440a-940e-77aa81a9af4b",
|
||||||
|
"ownerId": "eabfbf0b-ba3f-40f5-8dcb-8aaba788f8e3",
|
||||||
|
"roomId": "1eca2d6d-d15d-4f0e-9e32-8709acb9b3fe",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"id": "main",
|
||||||
|
"label": "main",
|
||||||
|
"capabilities": [
|
||||||
|
{
|
||||||
|
"id": "temperatureMeasurement",
|
||||||
|
"version": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "atmosphericPressureMeasurement",
|
||||||
|
"version": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "legendabsolute60149.atmosPressure",
|
||||||
|
"version": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "relativeHumidityMeasurement",
|
||||||
|
"version": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "configuration",
|
||||||
|
"version": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "battery",
|
||||||
|
"version": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"categories": [
|
||||||
|
{
|
||||||
|
"name": "Thermostat",
|
||||||
|
"categoryType": "manufacturer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"createTime": "2024-06-12T21:27:55.959Z",
|
||||||
|
"parentDeviceId": "61f28b8c-b975-415a-9197-fbc4e441e77a",
|
||||||
|
"profile": {
|
||||||
|
"id": "fa7886ec-6139-3357-8f4a-07a66491c173"
|
||||||
|
},
|
||||||
|
"zigbee": {
|
||||||
|
"eui": "00158D000967924A",
|
||||||
|
"networkId": "4B01",
|
||||||
|
"driverId": "c09c02d7-d05d-4bf4-831b-207a1adeae2f",
|
||||||
|
"executingLocally": true,
|
||||||
|
"hubId": "61f28b8c-b975-415a-9197-fbc4e441e77a",
|
||||||
|
"provisioningState": "NONFUNCTIONAL",
|
||||||
|
"fingerprintType": "ZIGBEE_MANUFACTURER",
|
||||||
|
"fingerprintId": "lumi.weather"
|
||||||
|
},
|
||||||
|
"type": "ZIGBEE",
|
||||||
|
"restrictionTier": 0,
|
||||||
|
"allowed": null,
|
||||||
|
"executionContext": "LOCAL",
|
||||||
|
"relationships": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_links": {}
|
||||||
|
}
|
@ -1685,6 +1685,39 @@
|
|||||||
'via_device_id': None,
|
'via_device_id': None,
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_devices[lumi]
|
||||||
|
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',
|
||||||
|
'692ea4e9-2022-4ed8-8a57-1b884a59cc38',
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
'is_new': False,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'manufacturer': None,
|
||||||
|
'model': None,
|
||||||
|
'model_id': None,
|
||||||
|
'name': 'Outdoor Temp',
|
||||||
|
'name_by_user': None,
|
||||||
|
'primary_config_entry': <ANY>,
|
||||||
|
'serial_number': None,
|
||||||
|
'suggested_area': None,
|
||||||
|
'sw_version': None,
|
||||||
|
'via_device_id': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_devices[multipurpose_sensor]
|
# name: test_devices[multipurpose_sensor]
|
||||||
DeviceRegistryEntrySnapshot({
|
DeviceRegistryEntrySnapshot({
|
||||||
'area_id': 'theater',
|
'area_id': 'theater',
|
||||||
|
@ -10877,6 +10877,214 @@
|
|||||||
'state': '37',
|
'state': '37',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_all_entities[lumi][sensor.outdoor_temp_atmospheric_pressure-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.outdoor_temp_atmospheric_pressure',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
'sensor.private': dict({
|
||||||
|
'suggested_unit_of_measurement': <UnitOfPressure.HPA: 'hPa'>,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.ATMOSPHERIC_PRESSURE: 'atmospheric_pressure'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Atmospheric pressure',
|
||||||
|
'platform': 'smartthings',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '692ea4e9-2022-4ed8-8a57-1b884a59cc38_main_atmosphericPressureMeasurement_atmosphericPressure_atmosphericPressure',
|
||||||
|
'unit_of_measurement': <UnitOfPressure.HPA: 'hPa'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_all_entities[lumi][sensor.outdoor_temp_atmospheric_pressure-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'atmospheric_pressure',
|
||||||
|
'friendly_name': 'Outdoor Temp Atmospheric pressure',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.HPA: 'hPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.outdoor_temp_atmospheric_pressure',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '1000',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_all_entities[lumi][sensor.outdoor_temp_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.outdoor_temp_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': '692ea4e9-2022-4ed8-8a57-1b884a59cc38_main_battery_battery_battery',
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_all_entities[lumi][sensor.outdoor_temp_battery-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'battery',
|
||||||
|
'friendly_name': 'Outdoor Temp Battery',
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.outdoor_temp_battery',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '100',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_all_entities[lumi][sensor.outdoor_temp_humidity-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.outdoor_temp_humidity',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.HUMIDITY: 'humidity'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Humidity',
|
||||||
|
'platform': 'smartthings',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '692ea4e9-2022-4ed8-8a57-1b884a59cc38_main_relativeHumidityMeasurement_humidity_humidity',
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_all_entities[lumi][sensor.outdoor_temp_humidity-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'humidity',
|
||||||
|
'friendly_name': 'Outdoor Temp Humidity',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.outdoor_temp_humidity',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '27.24',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_all_entities[lumi][sensor.outdoor_temp_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.outdoor_temp_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': '692ea4e9-2022-4ed8-8a57-1b884a59cc38_main_temperatureMeasurement_temperature_temperature',
|
||||||
|
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_all_entities[lumi][sensor.outdoor_temp_temperature-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'temperature',
|
||||||
|
'friendly_name': 'Outdoor Temp Temperature',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.outdoor_temp_temperature',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '24.4',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_all_entities[multipurpose_sensor][sensor.deck_door_battery-entry]
|
# name: test_all_entities[multipurpose_sensor][sensor.deck_door_battery-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user