Add sensor for brightness intensity to SmartThings (#141368)

This commit is contained in:
Joost Lekkerkerker 2025-03-25 18:45:10 +01:00 committed by GitHub
parent e1eb031022
commit 73642da7a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 320 additions and 0 deletions

View File

@ -675,6 +675,15 @@ CAPABILITY_TO_SENSORS: dict[
)
]
},
Capability.RELATIVE_BRIGHTNESS: {
Attribute.BRIGHTNESS_INTENSITY: [
SmartThingsSensorEntityDescription(
key=Attribute.BRIGHTNESS_INTENSITY,
translation_key="brightness_intensity",
state_class=SensorStateClass.MEASUREMENT,
)
]
},
Capability.RELATIVE_HUMIDITY_MEASUREMENT: {
Attribute.HUMIDITY: [
SmartThingsSensorEntityDescription(

View File

@ -345,6 +345,9 @@
"refrigeration_setpoint": {
"name": "[%key:component::smartthings::entity::sensor::oven_setpoint::name%]"
},
"brightness_intensity": {
"name": "Brightness intensity"
},
"robot_cleaner_cleaning_mode": {
"name": "Cleaning mode",
"state": {

View File

@ -106,6 +106,7 @@ def mock_smartthings() -> Generator[AsyncMock]:
"centralite",
"da_ref_normal_000001",
"vd_network_audio_002s",
"vd_sensor_light_2023",
"iphone",
"da_sac_ehs_000001_sub",
"da_wm_dw_000001",

View File

@ -0,0 +1,95 @@
{
"components": {
"main": {
"ocf": {
"st": {
"value": "2025-01-14T08:07:36Z",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"mndt": {
"value": "2023-01-01",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"mnfv": {
"value": "latest",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"mnhw": {
"value": "",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"di": {
"value": "5cc1c096-98b9-460c-8f1c-1045509ec605",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"mnsl": {
"value": "",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"dmv": {
"value": "res.1.1.0,sh.1.1.0",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"n": {
"value": "Light Sensor - 55 The Frame",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"mnmo": {
"value": "QE55LS03DAUXXN",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"vid": {
"value": "VD-Sensor.Light-2023",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"mnmn": {
"value": "Samsung Electronics",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"mnml": {
"value": "",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"mnpv": {
"value": "8.0",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"mnos": {
"value": "Tizen",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"pi": {
"value": "5cc1c096-98b9-460c-8f1c-1045509ec605",
"timestamp": "2025-01-14T08:07:40.220Z"
},
"icv": {
"value": "core.1.1.0",
"timestamp": "2025-01-14T08:07:40.220Z"
}
},
"samsungvd.deviceCategory": {
"category": {
"value": null
}
},
"relativeBrightness": {
"brightnessIntensity": {
"value": 2,
"unit": "level",
"timestamp": "2025-02-11T19:08:25.539Z"
}
},
"refresh": {},
"execute": {
"data": {
"value": null
}
},
"switch": {
"switch": {
"value": null
}
}
}
}
}

View File

@ -0,0 +1,81 @@
{
"items": [
{
"deviceId": "5cc1c096-98b9-460c-8f1c-1045509ec605",
"name": "VD-Sensor.Light-2023",
"label": "Light Sensor - 55\" The Frame",
"manufacturerName": "Samsung Electronics",
"presentationId": "VD-Sensor.Light-2023",
"deviceManufacturerCode": "Samsung Electronics",
"locationId": "df59873c-4e2c-43ba-bcd4-ade4efb0504a",
"ownerId": "71254e90-c144-45b6-aabe-709f78f48376",
"roomId": "8a4fac38-48d1-4a8c-922b-92620442363b",
"deviceTypeName": "x.com.st.d.sensor.light",
"components": [
{
"id": "main",
"label": "main",
"capabilities": [
{
"id": "ocf",
"version": 1
},
{
"id": "switch",
"version": 1
},
{
"id": "refresh",
"version": 1
},
{
"id": "execute",
"version": 1
},
{
"id": "relativeBrightness",
"version": 1
},
{
"id": "samsungvd.deviceCategory",
"version": 1
}
],
"categories": [
{
"name": "LightSensor",
"categoryType": "manufacturer"
}
]
}
],
"createTime": "2024-11-15T22:21:27.908Z",
"parentDeviceId": "425ac77a-f7c9-a62d-ff12-cdad144952e3",
"profile": {
"id": "5f1633fb-0c63-34d3-9d04-a314d393d225"
},
"ocf": {
"ocfDeviceType": "x.com.st.d.sensor.light",
"name": "Light Sensor - 55 The Frame",
"specVersion": "core.1.1.0",
"verticalDomainSpecVersion": "res.1.1.0,sh.1.1.0",
"manufacturerName": "Samsung Electronics",
"modelNumber": "QE55LS03DAUXXN",
"platformVersion": "8.0",
"platformOS": "Tizen",
"hwVersion": "",
"firmwareVersion": "latest",
"vendorId": "VD-Sensor.Light-2023",
"vendorResourceClientServerVersion": "4.0.26",
"lastSignupTime": "2024-11-15T22:21:27.933740026Z",
"transferCandidate": false,
"additionalAuthCodeRequired": false
},
"type": "OCF",
"restrictionTier": 0,
"allowed": [],
"executionContext": "CLOUD"
}
],
"_links": {}
}

View File

@ -1487,6 +1487,39 @@
'via_device_id': None,
})
# ---
# name: test_devices[vd_sensor_light_2023]
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': '',
'id': <ANY>,
'identifiers': set({
tuple(
'smartthings',
'5cc1c096-98b9-460c-8f1c-1045509ec605',
),
}),
'is_new': False,
'labels': set({
}),
'manufacturer': 'Samsung Electronics',
'model': 'QE55LS03DAUXXN',
'model_id': None,
'name': 'Light Sensor - 55" The Frame',
'name_by_user': None,
'primary_config_entry': <ANY>,
'serial_number': None,
'suggested_area': None,
'sw_version': 'latest',
'via_device_id': None,
})
# ---
# name: test_devices[vd_stv_2017_k]
DeviceRegistryEntrySnapshot({
'area_id': 'theater',

View File

@ -8347,6 +8347,57 @@
'state': '17',
})
# ---
# name: test_all_entities[vd_sensor_light_2023][sensor.light_sensor_55_the_frame_brightness_intensity-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.light_sensor_55_the_frame_brightness_intensity',
'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': 'Brightness intensity',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'brightness_intensity',
'unique_id': '5cc1c096-98b9-460c-8f1c-1045509ec605.brightnessIntensity',
'unit_of_measurement': 'level',
})
# ---
# name: test_all_entities[vd_sensor_light_2023][sensor.light_sensor_55_the_frame_brightness_intensity-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Light Sensor - 55" The Frame Brightness intensity',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': 'level',
}),
'context': <ANY>,
'entity_id': 'sensor.light_sensor_55_the_frame_brightness_intensity',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '2',
})
# ---
# name: test_all_entities[vd_stv_2017_k][sensor.tv_samsung_8_series_49_media_input_source-entry]
EntityRegistryEntrySnapshot({
'aliases': set({

View File

@ -845,6 +845,53 @@
'state': 'on',
})
# ---
# name: test_all_entities[vd_sensor_light_2023][switch.light_sensor_55_the_frame-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': 'switch',
'entity_category': None,
'entity_id': 'switch.light_sensor_55_the_frame',
'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': 0,
'translation_key': None,
'unique_id': '5cc1c096-98b9-460c-8f1c-1045509ec605',
'unit_of_measurement': None,
})
# ---
# name: test_all_entities[vd_sensor_light_2023][switch.light_sensor_55_the_frame-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Light Sensor - 55" The Frame',
}),
'context': <ANY>,
'entity_id': 'switch.light_sensor_55_the_frame',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_all_entities[vd_stv_2017_k][switch.tv_samsung_8_series_49-entry]
EntityRegistryEntrySnapshot({
'aliases': set({