mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Handle missing mac address in syncthru (#55154)
* Fix access errors to mac address printer.raw() is the only attribute accessed and will always be present. However depending on the printer, the mac address might be missing. * Update homeassistant/components/syncthru/__init__.py Co-authored-by: J. Nick Koston <nick@koston.org> * Update homeassistant/components/syncthru/__init__.py Co-authored-by: J. Nick Koston <nick@koston.org> * Update homeassistant/components/syncthru/__init__.py Co-authored-by: J. Nick Koston <nick@koston.org> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
2e62de5116
commit
abfba1f455
@ -86,11 +86,6 @@ def device_identifiers(printer: SyncThru) -> set[tuple[str, str]] | None:
|
||||
|
||||
def device_connections(printer: SyncThru) -> set[tuple[str, str]]:
|
||||
"""Get device connections for device registry."""
|
||||
connections = set()
|
||||
try:
|
||||
mac = printer.raw()["identity"]["mac_addr"]
|
||||
if mac:
|
||||
connections.add((dr.CONNECTION_NETWORK_MAC, mac))
|
||||
except AttributeError:
|
||||
pass
|
||||
return connections
|
||||
if mac := printer.raw().get("identity", {}).get("mac_addr"):
|
||||
return {(dr.CONNECTION_NETWORK_MAC, mac)}
|
||||
return set()
|
||||
|
Loading…
x
Reference in New Issue
Block a user