@@ -457,16 +457,6 @@ async def _async_state_changed_listener(
457457 self .coordinator .wrapped_battery .entity_id , hidden_by = None
458458 )
459459
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-
470460 self .async_on_remove (
471461 self .coordinator .async_add_listener (self ._handle_coordinator_update )
472462 )
@@ -639,7 +629,7 @@ def _set_native_value(self, log_on_error=True):
639629 # pylint: disable=unused-argument
640630 device_entry = self .coordinator .store .async_get_device (self ._device_id )
641631 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 :
643633 last_replaced_date = datetime .fromisoformat (
644634 str (device_entry [LAST_REPLACED ]) + "+00:00"
645635 )
@@ -654,7 +644,7 @@ def _handle_coordinator_update(self) -> None:
654644
655645 device_entry = self .coordinator .store .async_get_device (self ._device_id )
656646 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 :
658648 last_replaced_date = datetime .fromisoformat (
659649 str (device_entry [LAST_REPLACED ]) + "+00:00"
660650 )
0 commit comments