Improve IPP Config Flow (#34212)
This commit is contained in:
1 parent
ede432ba71
commit
9d794b820a
6 files changed
+79
-26
No files matched your search
@@ -134,13 +134,18 @@ class IPPEntity(Entity):
|
||||
enabled_default: bool = True,
|
||||
) -> None:
|
||||
"""Initialize the IPP entity."""
|
||||
self._device_id = None
|
||||
self._enabled_default = enabled_default
|
||||
self._entry_id = entry_id
|
||||
self._icon = icon
|
||||
self._name = name
|
||||
self._unsub_dispatcher = None
|
||||
self.coordinator = coordinator
|
||||
|
||||
if coordinator.data.info.uuid is not None:
|
||||
self._device_id = coordinator.data.info.uuid
|
||||
elif coordinator.data.info.serial is not None:
|
||||
self._device_id = coordinator.data.info.serial
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Return the name of the entity."""
|
||||
@@ -179,8 +184,11 @@ class IPPEntity(Entity):
|
||||
@property
|
||||
def device_info(self) -> Dict[str, Any]:
|
||||
"""Return device information about this IPP device."""
|
||||
if self._device_id is None:
|
||||
return None
|
||||
|
||||
return {
|
||||
ATTR_IDENTIFIERS: {(DOMAIN, self.coordinator.data.info.uuid)},
|
||||
ATTR_IDENTIFIERS: {(DOMAIN, self._device_id)},
|
||||
ATTR_NAME: self.coordinator.data.info.name,
|
||||
ATTR_MANUFACTURER: self.coordinator.data.info.manufacturer,
|
||||
ATTR_MODEL: self.coordinator.data.info.model,
|
||||
|
||||
Reference in new issue
Block a user