@@ -496,21 +496,20 @@ def __init__(
496496 self .PLATFORM = entity_info .platform
497497 self ._device : WebSocketClientDevice = device
498498 self ._entity_info : BaseEntityInfoType = entity_info
499- self ._attr_enabled = self ._entity_info .enabled
500- self ._attr_fallback_name = self ._entity_info .fallback_name
501- self ._attr_translation_key = self ._entity_info .translation_key
502- self ._attr_entity_category = self ._entity_info .entity_category
503- self ._attr_entity_registry_enabled_default = (
504- self ._entity_info .entity_registry_enabled_default
505- )
506- self ._attr_device_class = self ._entity_info .device_class
507- self ._attr_state_class = self ._entity_info .state_class
499+ self ._update_attrs_from_entity_info ()
508500
509501 @property
510502 def info_object (self ) -> BaseEntityInfoType :
511503 """Return a representation of the alarm control panel."""
512504 return self ._entity_info
513505
506+ @info_object .setter
507+ def info_object (self , entity_info : BaseEntityInfoType ) -> None :
508+ """Set the entity info object."""
509+ self ._entity_info = entity_info
510+ self ._update_attrs_from_entity_info ()
511+ self .maybe_emit_state_changed_event ()
512+
514513 @property
515514 def state (self ) -> dict [str , Any ]:
516515 """Return the arguments to use in the command."""
@@ -521,6 +520,7 @@ def state(self, value: dict[str, Any]) -> None:
521520 """Set the state of the entity."""
522521 self ._entity_info .state = value
523522 self ._attr_enabled = self ._entity_info .enabled
523+ self .maybe_emit_state_changed_event ()
524524
525525 @property
526526 def group_id (self ) -> int | None :
@@ -562,6 +562,18 @@ def _disable(self, future: asyncio.Future) -> None:
562562 self ._attr_enabled = False
563563 self .maybe_emit_state_changed_event ()
564564
565+ def _update_attrs_from_entity_info (self ) -> None :
566+ """Update the entity attributes."""
567+ self ._attr_enabled = self ._entity_info .enabled
568+ self ._attr_fallback_name = self ._entity_info .fallback_name
569+ self ._attr_translation_key = self ._entity_info .translation_key
570+ self ._attr_entity_category = self ._entity_info .entity_category
571+ self ._attr_entity_registry_enabled_default = (
572+ self ._entity_info .entity_registry_enabled_default
573+ )
574+ self ._attr_device_class = self ._entity_info .device_class
575+ self ._attr_state_class = self ._entity_info .state_class
576+
565577 async def async_update (self ) -> None :
566578 """Retrieve latest state."""
567579 self .debug ("polling current state" )
0 commit comments