We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d783652 commit cac9e18Copy full SHA for cac9e18
custom_components/battery_notes/device.py
@@ -193,13 +193,13 @@ async def async_setup(self) -> bool:
193
if entity.device_id:
194
device_entry = device_registry.async_get(entity.device_id)
195
196
- if device_entry.created_at.year > 1970:
+ if device_entry and device_entry.created_at.year > 1970:
197
last_replaced = device_entry.created_at.strftime(
198
"%Y-%m-%dT%H:%M:%S:%f"
199
)
200
else:
201
entity = entity_registry.async_get(source_entity_id)
202
- if entity.created_at.year > 1970:
+ if entity and entity.created_at.year > 1970:
203
last_replaced = entity.created_at.strftime("%Y-%m-%dT%H:%M:%S:%f")
204
205
_LOGGER.debug(
0 commit comments