Skip to content

Commit

Permalink
Fix last reported
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-codechimp committed Oct 27, 2024
1 parent 7466a49 commit bb5aaf1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions custom_components/battery_notes/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ async def async_setup(self) -> bool:
device_entry = device_registry.async_get(entity.device_id)

if device_entry.created_at.year > 1970:
last_replaced = device_entry.created_at.strftime("%Y-%m-%dT%H:%M:%S:%f")
last_replaced = device_entry.created_at.strftime(
"%Y-%m-%dT%H:%M:%S:%f"
)
else:
entity = entity_registry.async_get(source_entity_id)
if entity.created_at.year > 1970:
Expand All @@ -214,7 +216,7 @@ async def async_setup(self) -> bool:
_LOGGER.debug(
"Defaulting %s battery last reported to %s",
source_entity_id or device_id,
last_replaced,
last_reported,
)
self.coordinator.last_reported = last_reported

Expand Down

0 comments on commit bb5aaf1

Please sign in to comment.