@@ -457,16 +457,6 @@ async def _async_state_changed_listener(
457
457
self .coordinator .wrapped_battery .entity_id , hidden_by = None
458
458
)
459
459
460
- def copy_custom_name (wrapped_battery : er .RegistryEntry ) -> None :
461
- """Copy the name set by user from the wrapped entity."""
462
- if wrapped_battery .name is None :
463
- return
464
- registry .async_update_entity (
465
- self .entity_id , name = wrapped_battery .name + "+"
466
- )
467
-
468
- copy_custom_name (self .coordinator .wrapped_battery )
469
-
470
460
self .async_on_remove (
471
461
self .coordinator .async_add_listener (self ._handle_coordinator_update )
472
462
)
@@ -639,7 +629,7 @@ def _set_native_value(self, log_on_error=True):
639
629
# pylint: disable=unused-argument
640
630
device_entry = self .coordinator .store .async_get_device (self ._device_id )
641
631
if device_entry :
642
- if LAST_REPLACED in device_entry :
632
+ if LAST_REPLACED in device_entry and device_entry [ LAST_REPLACED ] is not None :
643
633
last_replaced_date = datetime .fromisoformat (
644
634
str (device_entry [LAST_REPLACED ]) + "+00:00"
645
635
)
@@ -654,7 +644,7 @@ def _handle_coordinator_update(self) -> None:
654
644
655
645
device_entry = self .coordinator .store .async_get_device (self ._device_id )
656
646
if device_entry :
657
- if LAST_REPLACED in device_entry :
647
+ if LAST_REPLACED in device_entry and device_entry [ LAST_REPLACED ] is not None :
658
648
last_replaced_date = datetime .fromisoformat (
659
649
str (device_entry [LAST_REPLACED ]) + "+00:00"
660
650
)
0 commit comments