Add smartthings configuration_url (#58676)

pull/59693/head
Robert Hillis 2021-11-14 14:37:40 -05:00 committed by GitHub
parent cd988bded0
commit 85aeee7cc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 35 additions and 8 deletions

View File

@ -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:

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"