From 85aeee7cc73e55ce30b5bf609e0251c9758265b7 Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Sun, 14 Nov 2021 14:37:40 -0500 Subject: [PATCH] Add smartthings configuration_url (#58676) --- .../components/smartthings/__init__.py | 17 +++++++++-------- .../smartthings/test_binary_sensor.py | 2 ++ tests/components/smartthings/test_climate.py | 2 ++ tests/components/smartthings/test_cover.py | 2 ++ tests/components/smartthings/test_fan.py | 2 ++ tests/components/smartthings/test_light.py | 2 ++ tests/components/smartthings/test_lock.py | 2 ++ tests/components/smartthings/test_sensor.py | 12 ++++++++++++ tests/components/smartthings/test_switch.py | 2 ++ 9 files changed, 35 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/smartthings/__init__.py b/homeassistant/components/smartthings/__init__.py index eb3aa9cb0f0..3f10758076f 100644 --- a/homeassistant/components/smartthings/__init__.py +++ b/homeassistant/components/smartthings/__init__.py @@ -21,7 +21,7 @@ from homeassistant.helpers.dispatcher import ( async_dispatcher_connect, async_dispatcher_send, ) -from homeassistant.helpers.entity import Entity +from homeassistant.helpers.entity import DeviceInfo, Entity from homeassistant.helpers.event import async_track_time_interval from homeassistant.helpers.typing import ConfigType @@ -428,14 +428,15 @@ class SmartThingsEntity(Entity): self._dispatcher_remove() @property - def device_info(self): + def device_info(self) -> DeviceInfo: """Get attributes about the device.""" - return { - "identifiers": {(DOMAIN, self._device.device_id)}, - "name": self._device.label, - "model": self._device.device_type_name, - "manufacturer": "Unavailable", - } + return DeviceInfo( + configuration_url="https://account.smartthings.com", + identifiers={(DOMAIN, self._device.device_id)}, + manufacturer="Unavailable", + model=self._device.device_type_name, + name=self._device.label, + ) @property def name(self) -> str: diff --git a/tests/components/smartthings/test_binary_sensor.py b/tests/components/smartthings/test_binary_sensor.py index efc34424ae0..7f4748bc215 100644 --- a/tests/components/smartthings/test_binary_sensor.py +++ b/tests/components/smartthings/test_binary_sensor.py @@ -65,6 +65,8 @@ async def test_entity_and_device_attributes(hass, device_factory): assert entry.unique_id == f"{device.device_id}.{Attribute.motion}" entry = device_registry.async_get_device({(DOMAIN, device.device_id)}) assert entry + assert entry.configuration_url == "https://account.smartthings.com" + assert entry.identifiers == {(DOMAIN, device.device_id)} assert entry.name == device.label assert entry.model == device.device_type_name assert entry.manufacturer == "Unavailable" diff --git a/tests/components/smartthings/test_climate.py b/tests/components/smartthings/test_climate.py index dc8f2acc9fa..17443b72029 100644 --- a/tests/components/smartthings/test_climate.py +++ b/tests/components/smartthings/test_climate.py @@ -579,6 +579,8 @@ async def test_entity_and_device_attributes(hass, thermostat): entry = device_registry.async_get_device({(DOMAIN, thermostat.device_id)}) assert entry + assert entry.configuration_url == "https://account.smartthings.com" + assert entry.identifiers == {(DOMAIN, thermostat.device_id)} assert entry.name == thermostat.label assert entry.model == thermostat.device_type_name assert entry.manufacturer == "Unavailable" diff --git a/tests/components/smartthings/test_cover.py b/tests/components/smartthings/test_cover.py index aad7a4b037e..4111d21b25b 100644 --- a/tests/components/smartthings/test_cover.py +++ b/tests/components/smartthings/test_cover.py @@ -44,6 +44,8 @@ async def test_entity_and_device_attributes(hass, device_factory): entry = device_registry.async_get_device({(DOMAIN, device.device_id)}) assert entry + assert entry.configuration_url == "https://account.smartthings.com" + assert entry.identifiers == {(DOMAIN, device.device_id)} assert entry.name == device.label assert entry.model == device.device_type_name assert entry.manufacturer == "Unavailable" diff --git a/tests/components/smartthings/test_fan.py b/tests/components/smartthings/test_fan.py index 2a66fc646c7..16b0360f9eb 100644 --- a/tests/components/smartthings/test_fan.py +++ b/tests/components/smartthings/test_fan.py @@ -70,6 +70,8 @@ async def test_entity_and_device_attributes(hass, device_factory): entry = device_registry.async_get_device({(DOMAIN, device.device_id)}) assert entry + assert entry.configuration_url == "https://account.smartthings.com" + assert entry.identifiers == {(DOMAIN, device.device_id)} assert entry.name == device.label assert entry.model == device.device_type_name assert entry.manufacturer == "Unavailable" diff --git a/tests/components/smartthings/test_light.py b/tests/components/smartthings/test_light.py index 81062adf934..166b0606b66 100644 --- a/tests/components/smartthings/test_light.py +++ b/tests/components/smartthings/test_light.py @@ -123,6 +123,8 @@ async def test_entity_and_device_attributes(hass, device_factory): entry = device_registry.async_get_device({(DOMAIN, device.device_id)}) assert entry + assert entry.configuration_url == "https://account.smartthings.com" + assert entry.identifiers == {(DOMAIN, device.device_id)} assert entry.name == device.label assert entry.model == device.device_type_name assert entry.manufacturer == "Unavailable" diff --git a/tests/components/smartthings/test_lock.py b/tests/components/smartthings/test_lock.py index 86c8d534a71..f1ab6640058 100644 --- a/tests/components/smartthings/test_lock.py +++ b/tests/components/smartthings/test_lock.py @@ -32,6 +32,8 @@ async def test_entity_and_device_attributes(hass, device_factory): entry = device_registry.async_get_device({(DOMAIN, device.device_id)}) assert entry + assert entry.configuration_url == "https://account.smartthings.com" + assert entry.identifiers == {(DOMAIN, device.device_id)} assert entry.name == device.label assert entry.model == device.device_type_name assert entry.manufacturer == "Unavailable" diff --git a/tests/components/smartthings/test_sensor.py b/tests/components/smartthings/test_sensor.py index 049666baf99..0e22a1facba 100644 --- a/tests/components/smartthings/test_sensor.py +++ b/tests/components/smartthings/test_sensor.py @@ -98,6 +98,8 @@ async def test_entity_and_device_attributes(hass, device_factory): assert entry.entity_category == ENTITY_CATEGORY_DIAGNOSTIC entry = device_registry.async_get_device({(DOMAIN, device.device_id)}) assert entry + assert entry.configuration_url == "https://account.smartthings.com" + assert entry.identifiers == {(DOMAIN, device.device_id)} assert entry.name == device.label assert entry.model == device.device_type_name assert entry.manufacturer == "Unavailable" @@ -125,6 +127,8 @@ async def test_energy_sensors_for_switch_device(hass, device_factory): assert entry.entity_category is None entry = device_registry.async_get_device({(DOMAIN, device.device_id)}) assert entry + assert entry.configuration_url == "https://account.smartthings.com" + assert entry.identifiers == {(DOMAIN, device.device_id)} assert entry.name == device.label assert entry.model == device.device_type_name assert entry.manufacturer == "Unavailable" @@ -138,6 +142,8 @@ async def test_energy_sensors_for_switch_device(hass, device_factory): assert entry.entity_category is None entry = device_registry.async_get_device({(DOMAIN, device.device_id)}) assert entry + assert entry.configuration_url == "https://account.smartthings.com" + assert entry.identifiers == {(DOMAIN, device.device_id)} assert entry.name == device.label assert entry.model == device.device_type_name assert entry.manufacturer == "Unavailable" @@ -175,6 +181,8 @@ async def test_power_consumption_sensor(hass, device_factory): assert entry.unique_id == f"{device.device_id}.energy_meter" entry = device_registry.async_get_device({(DOMAIN, device.device_id)}) assert entry + assert entry.configuration_url == "https://account.smartthings.com" + assert entry.identifiers == {(DOMAIN, device.device_id)} assert entry.name == device.label assert entry.model == device.device_type_name assert entry.manufacturer == "Unavailable" @@ -187,6 +195,8 @@ async def test_power_consumption_sensor(hass, device_factory): assert entry.unique_id == f"{device.device_id}.power_meter" entry = device_registry.async_get_device({(DOMAIN, device.device_id)}) assert entry + assert entry.configuration_url == "https://account.smartthings.com" + assert entry.identifiers == {(DOMAIN, device.device_id)} assert entry.name == device.label assert entry.model == device.device_type_name assert entry.manufacturer == "Unavailable" @@ -209,6 +219,8 @@ async def test_power_consumption_sensor(hass, device_factory): assert entry.unique_id == f"{device.device_id}.energy_meter" entry = device_registry.async_get_device({(DOMAIN, device.device_id)}) assert entry + assert entry.configuration_url == "https://account.smartthings.com" + assert entry.identifiers == {(DOMAIN, device.device_id)} assert entry.name == device.label assert entry.model == device.device_type_name assert entry.manufacturer == "Unavailable" diff --git a/tests/components/smartthings/test_switch.py b/tests/components/smartthings/test_switch.py index c884d601baf..77c7f4d2c7e 100644 --- a/tests/components/smartthings/test_switch.py +++ b/tests/components/smartthings/test_switch.py @@ -31,6 +31,8 @@ async def test_entity_and_device_attributes(hass, device_factory): entry = device_registry.async_get_device({(DOMAIN, device.device_id)}) assert entry + assert entry.configuration_url == "https://account.smartthings.com" + assert entry.identifiers == {(DOMAIN, device.device_id)} assert entry.name == device.label assert entry.model == device.device_type_name assert entry.manufacturer == "Unavailable"