diff --git a/homeassistant/components/smartthings/light.py b/homeassistant/components/smartthings/light.py index 9f845b032047..d5b5003029a5 100644 --- a/homeassistant/components/smartthings/light.py +++ b/homeassistant/components/smartthings/light.py @@ -72,8 +72,10 @@ async def async_setup_entry( for device in entry_data.devices.values() for component in device.status if ( - Capability.SWITCH in device.status[MAIN] - and any(capability in device.status[MAIN] for capability in CAPABILITIES) + Capability.SWITCH in device.status[component] + and any( + capability in device.status[component] for capability in CAPABILITIES + ) and Capability.SAMSUNG_CE_LAMP not in device.status[component] ) ] diff --git a/tests/components/smartthings/__init__.py b/tests/components/smartthings/__init__.py index e792afab2c29..95029f0c0a35 100644 --- a/tests/components/smartthings/__init__.py +++ b/tests/components/smartthings/__init__.py @@ -39,6 +39,7 @@ DEVICE_FIXTURES = [ "copper_water_meter_v03", "base_electric_meter", "smart_plug", + "fibaro_dimmer_2", "vd_stv_2017_k", "c2c_arlo_pro_3_switch", "yale_push_button_deadbolt_lock", diff --git a/tests/components/smartthings/fixtures/device_status/fibaro_dimmer_2.json b/tests/components/smartthings/fixtures/device_status/fibaro_dimmer_2.json new file mode 100644 index 000000000000..b12f1adb2f39 --- /dev/null +++ b/tests/components/smartthings/fixtures/device_status/fibaro_dimmer_2.json @@ -0,0 +1,70 @@ +{ + "components": { + "button2": { + "button": { + "button": { + "value": null + }, + "numberOfButtons": { + "value": null + }, + "supportedButtonValues": { + "value": null + } + } + }, + "main": { + "powerMeter": { + "power": { + "value": 0.0, + "unit": "W", + "timestamp": "2026-05-28T12:21:31.639Z" + } + }, + "energyMeter": { + "energy": { + "value": 36.89, + "unit": "kWh", + "timestamp": "2026-05-28T12:32:57.766Z" + } + }, + "switchLevel": { + "levelRange": { + "value": null + }, + "level": { + "value": 0, + "unit": "%", + "timestamp": "2026-05-28T10:20:37.674Z" + } + }, + "legendabsolute60149.forcedOnLevel": { + "forcedOnLevel": { + "value": 5, + "unit": "%", + "timestamp": "2026-05-21T15:10:35.371Z" + } + }, + "refresh": {}, + "switch": { + "switch": { + "value": "off", + "timestamp": "2026-05-28T10:20:37.616Z" + } + } + }, + "button1": { + "button": { + "button": { + "value": null + }, + "numberOfButtons": { + "value": null + }, + "supportedButtonValues": { + "value": null + } + } + } + } +} diff --git a/tests/components/smartthings/fixtures/devices/fibaro_dimmer_2.json b/tests/components/smartthings/fixtures/devices/fibaro_dimmer_2.json new file mode 100644 index 000000000000..bd2fb8d00aa1 --- /dev/null +++ b/tests/components/smartthings/fixtures/devices/fibaro_dimmer_2.json @@ -0,0 +1,110 @@ +{ + "items": [ + { + "deviceId": "df9f5405-f930-46aa-9693-14c570b35c83", + "name": "fibaro-dimmer-2", + "label": "Dimmer entr\u00e9 1 1", + "manufacturerName": "SmartThingsCommunity", + "presentationId": "b1b79065-1923-3e7a-b016-9abcc3d1d416", + "deviceManufacturerCode": "010F-0102-1001", + "locationId": "c85a9f8a-5d2e-4cdd-8bdb-bc49ba4a3544", + "ownerId": "7b68139b-d068-45d8-bf27-961320350024", + "roomId": "f4084bf6-2985-47cc-b3c9-3907d098ec0c", + "components": [ + { + "id": "main", + "label": "main", + "capabilities": [ + { + "id": "switch", + "version": 1 + }, + { + "id": "switchLevel", + "version": 1 + }, + { + "id": "powerMeter", + "version": 1 + }, + { + "id": "energyMeter", + "version": 1 + }, + { + "id": "legendabsolute60149.forcedOnLevel", + "version": 1 + }, + { + "id": "refresh", + "version": 1 + } + ], + "categories": [ + { + "name": "Switch", + "categoryType": "manufacturer" + } + ], + "optional": false + }, + { + "id": "button1", + "label": "button1", + "capabilities": [ + { + "id": "button", + "version": 1 + } + ], + "categories": [ + { + "name": "RemoteController", + "categoryType": "manufacturer" + } + ], + "optional": false + }, + { + "id": "button2", + "label": "button2", + "capabilities": [ + { + "id": "button", + "version": 1 + } + ], + "categories": [ + { + "name": "RemoteController", + "categoryType": "manufacturer" + } + ], + "optional": false + } + ], + "createTime": "2023-04-23T06:35:16.202Z", + "parentDeviceId": "4869d882-e898-40c3-a198-7611b72187a5", + "profile": { + "id": "c6edf569-c7bb-38e7-a442-fe397ebe0cae" + }, + "zwave": { + "networkId": "0A", + "driverId": "17c05c19-f008-42e2-aa12-f12f1aae5612", + "executingLocally": true, + "hubId": "4869d882-e898-40c3-a198-7611b72187a5", + "networkSecurityLevel": "ZWAVE_S0_LEGACY", + "provisioningState": "NONFUNCTIONAL", + "manufacturerId": 271, + "productType": 258, + "productId": 4097 + }, + "type": "ZWAVE", + "restrictionTier": 0, + "allowed": null, + "executionContext": "LOCAL", + "relationships": [] + } + ], + "_links": {} +} diff --git a/tests/components/smartthings/snapshots/test_event.ambr b/tests/components/smartthings/snapshots/test_event.ambr index 1303388717dc..1f4c540c9685 100644 --- a/tests/components/smartthings/snapshots/test_event.ambr +++ b/tests/components/smartthings/snapshots/test_event.ambr @@ -1,4 +1,114 @@ # serializer version: 1 +# name: test_all_entities[fibaro_dimmer_2][event.dimmer_entre_1_1_button1-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + 'event_types': None, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'event', + 'entity_category': None, + 'entity_id': 'event.dimmer_entre_1_1_button1', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'button1', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'button1', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'button', + 'unique_id': 'df9f5405-f930-46aa-9693-14c570b35c83_button1_button', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[fibaro_dimmer_2][event.dimmer_entre_1_1_button1-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'button', + 'event_type': None, + 'event_types': None, + 'friendly_name': 'Dimmer entré 1 1 button1', + }), + 'context': , + 'entity_id': 'event.dimmer_entre_1_1_button1', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_all_entities[fibaro_dimmer_2][event.dimmer_entre_1_1_button2-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + 'event_types': None, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'event', + 'entity_category': None, + 'entity_id': 'event.dimmer_entre_1_1_button2', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'button2', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'button2', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'button', + 'unique_id': 'df9f5405-f930-46aa-9693-14c570b35c83_button2_button', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[fibaro_dimmer_2][event.dimmer_entre_1_1_button2-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'button', + 'event_type': None, + 'event_types': None, + 'friendly_name': 'Dimmer entré 1 1 button2', + }), + 'context': , + 'entity_id': 'event.dimmer_entre_1_1_button2', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- # name: test_all_entities[heatit_zpushwall][event.livingroom_smart_switch_button1-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ diff --git a/tests/components/smartthings/snapshots/test_init.ambr b/tests/components/smartthings/snapshots/test_init.ambr index 90d326d1a1a9..b827e2183c0f 100644 --- a/tests/components/smartthings/snapshots/test_init.ambr +++ b/tests/components/smartthings/snapshots/test_init.ambr @@ -1828,6 +1828,37 @@ 'via_device_id': None, }) # --- +# name: test_devices[fibaro_dimmer_2] + 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', + 'df9f5405-f930-46aa-9693-14c570b35c83', + ), + }), + 'labels': set({ + }), + 'manufacturer': None, + 'model': None, + 'model_id': None, + 'name': 'Dimmer entré 1 1', + 'name_by_user': None, + 'primary_config_entry': , + 'serial_number': None, + 'sw_version': None, + 'via_device_id': None, + }) +# --- # name: test_devices[gas_detector] DeviceRegistryEntrySnapshot({ 'area_id': None, diff --git a/tests/components/smartthings/snapshots/test_light.ambr b/tests/components/smartthings/snapshots/test_light.ambr index 3e8f614b213b..0ef795e66763 100644 --- a/tests/components/smartthings/snapshots/test_light.ambr +++ b/tests/components/smartthings/snapshots/test_light.ambr @@ -542,6 +542,66 @@ 'state': 'on', }) # --- +# name: test_all_entities[fibaro_dimmer_2][light.dimmer_entre_1_1-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.dimmer_entre_1_1', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'smartthings', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': 'df9f5405-f930-46aa-9693-14c570b35c83_main', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[fibaro_dimmer_2][light.dimmer_entre_1_1-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': None, + 'color_mode': None, + 'friendly_name': 'Dimmer entré 1 1', + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.dimmer_entre_1_1', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- # name: test_all_entities[ge_in_wall_smart_dimmer][light.theater_basement_exit_light-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ diff --git a/tests/components/smartthings/snapshots/test_sensor.ambr b/tests/components/smartthings/snapshots/test_sensor.ambr index d5015d17fff2..ca67688ef67a 100644 --- a/tests/components/smartthings/snapshots/test_sensor.ambr +++ b/tests/components/smartthings/snapshots/test_sensor.ambr @@ -19725,6 +19725,122 @@ 'state': 'unknown', }) # --- +# name: test_all_entities[fibaro_dimmer_2][sensor.dimmer_entre_1_1_energy-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + '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.dimmer_entre_1_1_energy', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Energy', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Energy', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'df9f5405-f930-46aa-9693-14c570b35c83_main_energyMeter_energy_energy', + 'unit_of_measurement': 'kWh', + }) +# --- +# name: test_all_entities[fibaro_dimmer_2][sensor.dimmer_entre_1_1_energy-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'energy', + 'friendly_name': 'Dimmer entré 1 1 Energy', + 'state_class': , + 'unit_of_measurement': 'kWh', + }), + 'context': , + 'entity_id': 'sensor.dimmer_entre_1_1_energy', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '36.89', + }) +# --- +# name: test_all_entities[fibaro_dimmer_2][sensor.dimmer_entre_1_1_power-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + '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.dimmer_entre_1_1_power', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Power', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 0, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Power', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'df9f5405-f930-46aa-9693-14c570b35c83_main_powerMeter_power_power', + 'unit_of_measurement': 'W', + }) +# --- +# name: test_all_entities[fibaro_dimmer_2][sensor.dimmer_entre_1_1_power-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'power', + 'friendly_name': 'Dimmer entré 1 1 Power', + 'state_class': , + 'unit_of_measurement': 'W', + }), + 'context': , + 'entity_id': 'sensor.dimmer_entre_1_1_power', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0.0', + }) +# --- # name: test_all_entities[gas_detector][sensor.gas_detector_link_quality-entry] EntityRegistryEntrySnapshot({ 'aliases': list([