Skip to content

Commit 29f1989

Browse files
Handle orphaned devices in BatteryNotesCoordinator initialization
1 parent 8c22460 commit 29f1989

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

custom_components/battery_notes/coordinator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ def __init__(
130130
self.device_id = config_entry.data.get(CONF_DEVICE_ID, None)
131131
self.source_entity_id = config_entry.data.get(CONF_SOURCE_ENTITY_ID, None)
132132

133-
self._link_device()
134-
135-
assert(self.device_name)
133+
if not self._link_device():
134+
self.is_orphaned = True
135+
return
136136

137137
self.battery_type = cast(str, self.config_entry.data.get(CONF_BATTERY_TYPE))
138138
try:

0 commit comments

Comments
 (0)