mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +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]]:
|
def device_connections(printer: SyncThru) -> set[tuple[str, str]]:
|
||||||
"""Get device connections for device registry."""
|
"""Get device connections for device registry."""
|
||||||
connections = set()
|
if mac := printer.raw().get("identity", {}).get("mac_addr"):
|
||||||
try:
|
return {(dr.CONNECTION_NETWORK_MAC, mac)}
|
||||||
mac = printer.raw()["identity"]["mac_addr"]
|
return set()
|
||||||
if mac:
|
|
||||||
connections.add((dr.CONNECTION_NETWORK_MAC, mac))
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
return connections
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user