From bb5aaf1f53318fe06b9323e02e6fb7059c3fa5d9 Mon Sep 17 00:00:00 2001 From: Andrew Jackson Date: Sun, 27 Oct 2024 10:15:42 +0000 Subject: [PATCH] Fix last reported --- custom_components/battery_notes/device.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/custom_components/battery_notes/device.py b/custom_components/battery_notes/device.py index 95a29961..bdc127c1 100644 --- a/custom_components/battery_notes/device.py +++ b/custom_components/battery_notes/device.py @@ -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: @@ -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