Add device configuration URL to WLED (#57692)

pull/57736/head
Franck Nijhof 2021-10-15 00:46:26 +02:00 committed by GitHub
parent a9737865ae
commit e077fb13ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 14 deletions

View File

@ -1,11 +1,4 @@
"""Models for WLED."""
from homeassistant.const import (
ATTR_IDENTIFIERS,
ATTR_MANUFACTURER,
ATTR_MODEL,
ATTR_NAME,
ATTR_SW_VERSION,
)
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEntity
@ -21,10 +14,11 @@ class WLEDEntity(CoordinatorEntity):
@property
def device_info(self) -> DeviceInfo:
"""Return device information about this WLED device."""
return {
ATTR_IDENTIFIERS: {(DOMAIN, self.coordinator.data.info.mac_address)},
ATTR_NAME: self.coordinator.data.info.name,
ATTR_MANUFACTURER: self.coordinator.data.info.brand,
ATTR_MODEL: self.coordinator.data.info.product,
ATTR_SW_VERSION: self.coordinator.data.info.version,
}
return DeviceInfo(
identifiers={(DOMAIN, self.coordinator.data.info.mac_address)},
name=self.coordinator.data.info.name,
manufacturer=self.coordinator.data.info.brand,
model=self.coordinator.data.info.product,
sw_version=self.coordinator.data.info.version,
configuration_url=f"http://{self.coordinator.wled.host}",
)

View File

@ -57,6 +57,7 @@ def mock_wled(request: pytest.FixtureRequest) -> Generator[None, MagicMock, None
wled = wled_mock.return_value
wled.update.return_value = device
wled.connected = False
wled.host = "127.0.0.1"
yield wled