mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Register base device entry during coordinator setup in AVM Fritz!Tools integration (#134764)
* register base device entry during coordinator setup * make mypy happy
This commit is contained in:
parent
bd8ea646a9
commit
a4ea25631a
@ -214,6 +214,18 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
|
|||||||
self._options = options
|
self._options = options
|
||||||
await self.hass.async_add_executor_job(self.setup)
|
await self.hass.async_add_executor_job(self.setup)
|
||||||
|
|
||||||
|
device_registry = dr.async_get(self.hass)
|
||||||
|
device_registry.async_get_or_create(
|
||||||
|
config_entry_id=self.config_entry.entry_id,
|
||||||
|
configuration_url=f"http://{self.host}",
|
||||||
|
connections={(dr.CONNECTION_NETWORK_MAC, self.mac)},
|
||||||
|
identifiers={(DOMAIN, self.unique_id)},
|
||||||
|
manufacturer="AVM",
|
||||||
|
model=self.model,
|
||||||
|
name=self.config_entry.title,
|
||||||
|
sw_version=self.current_firmware,
|
||||||
|
)
|
||||||
|
|
||||||
def setup(self) -> None:
|
def setup(self) -> None:
|
||||||
"""Set up FritzboxTools class."""
|
"""Set up FritzboxTools class."""
|
||||||
|
|
||||||
|
@ -68,23 +68,14 @@ class FritzBoxBaseEntity:
|
|||||||
"""Init device info class."""
|
"""Init device info class."""
|
||||||
self._avm_wrapper = avm_wrapper
|
self._avm_wrapper = avm_wrapper
|
||||||
self._device_name = device_name
|
self._device_name = device_name
|
||||||
|
self.mac_address = self._avm_wrapper.mac
|
||||||
@property
|
|
||||||
def mac_address(self) -> str:
|
|
||||||
"""Return the mac address of the main device."""
|
|
||||||
return self._avm_wrapper.mac
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self) -> DeviceInfo:
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return the device information."""
|
"""Return the device information."""
|
||||||
return DeviceInfo(
|
return DeviceInfo(
|
||||||
configuration_url=f"http://{self._avm_wrapper.host}",
|
|
||||||
connections={(dr.CONNECTION_NETWORK_MAC, self.mac_address)},
|
connections={(dr.CONNECTION_NETWORK_MAC, self.mac_address)},
|
||||||
identifiers={(DOMAIN, self._avm_wrapper.unique_id)},
|
identifiers={(DOMAIN, self._avm_wrapper.unique_id)},
|
||||||
manufacturer="AVM",
|
|
||||||
model=self._avm_wrapper.model,
|
|
||||||
name=self._device_name,
|
|
||||||
sw_version=self._avm_wrapper.current_firmware,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user