Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin Class Reference
Inheritance diagram for homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin:
[legend]
Collaboration diagram for homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin:
[legend]

Public Member Functions

None __init__ (self, HomeAssistant hass, DiscoveryInfoType|None discovery_data, Callable[[MQTTDiscoveryPayload], Coroutine[Any, Any, None]]|None discovery_update=None)
 
None add_to_platform_abort (self)
 
None add_to_platform_finish (self)
 
None async_added_to_hass (self)
 
None async_removed_from_registry (self)
 
None async_will_remove_from_hass (self)
 
- Public Member Functions inherited from homeassistant.helpers.entity.Entity
None __init_subclass__ (cls, **Any kwargs)
 
str __repr__ (self)
 
None add_to_platform_start (self, HomeAssistant hass, EntityPlatform platform, asyncio.Semaphore|None parallel_updates)
 
bool assumed_state (self)
 
None async_device_update (self, bool warning=True)
 
None async_internal_added_to_hass (self)
 
None async_internal_will_remove_from_hass (self)
 
None async_on_remove (self, CALLBACK_TYPE func)
 
None async_registry_entry_updated (self)
 
None async_remove (self, *bool force_remove=False)
 
None async_schedule_update_ha_state (self, bool force_refresh=False)
 
None async_set_context (self, Context context)
 
None async_update_ha_state (self, bool force_refresh=False)
 
None async_write_ha_state (self)
 
str|None attribution (self)
 
bool available (self)
 
dict[str, Any]|None capability_attributes (self)
 
str|None device_class (self)
 
DeviceInfo|None device_info (self)
 
bool enabled (self)
 
EntityCategory|None entity_category (self)
 
str|None entity_picture (self)
 
bool entity_registry_enabled_default (self)
 
bool entity_registry_visible_default (self)
 
Mapping[str, Any]|None extra_state_attributes (self)
 
bool force_update (self)
 
HassJobType get_hassjob_type (self, str function_name)
 
er.EntityOptionsType|None get_initial_entity_options (self)
 
bool has_entity_name (self)
 
str|None icon (self)
 
str|UndefinedType|None name (self)
 
None schedule_update_ha_state (self, bool force_refresh=False)
 
bool should_poll (self)
 
StateType state (self)
 
dict[str, Any]|None state_attributes (self)
 
str|None suggested_object_id (self)
 
int|None supported_features (self)
 
str|None translation_key (self)
 
Mapping[str, strtranslation_placeholders (self)
 
str|None unique_id (self)
 
str|None unit_of_measurement (self)
 
bool use_device_name (self)
 
- Public Member Functions inherited from homeassistant.helpers.entity.CachedProperties
None __init__ (cls, str name, tuple[type,...] bases, dict[Any, Any] namespace, **Any kwargs)
 
Any __new__ (mcs, str name, tuple[type,...] bases, dict[Any, Any] namespace, set[str]|None cached_properties=None, **Any kwargs)
 

Private Member Functions

None _async_discovery_callback (self, MQTTDiscoveryPayload payload)
 
None _async_process_discovery_update (self, MQTTDiscoveryPayload payload, Callable[[MQTTDiscoveryPayload], Coroutine[Any, Any, None]] discovery_update, DiscoveryInfoType discovery_data)
 
None _async_process_discovery_update_and_remove (self)
 
None _async_remove_state_and_registry_entry (MqttDiscoveryUpdateMixin self)
 
None _cleanup_discovery_on_remove (self)
 

Private Attributes

 _discovery_data
 
 _discovery_update
 
 _migrate_discovery
 
 _registry_hooks
 
 _remove_discovery_updated
 
 _removed_from_hass
 

Additional Inherited Members

- Public Attributes inherited from homeassistant.helpers.entity.Entity
 device_entry
 
 entity_id
 
 hass
 
 parallel_updates
 
 platform
 
 registry_entry
 
- Static Public Attributes inherited from homeassistant.helpers.entity.Entity
 bool
 
 EntityPlatform
 
 HomeAssistant
 
 None
 
 StateInfo
 
 StateType
 
 str
 

Detailed Description

Mixin used to handle updated discovery message for entity based platforms.

Definition at line 876 of file entity.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin.__init__ (   self,
HomeAssistant  hass,
DiscoveryInfoType | None  discovery_data,
Callable[[MQTTDiscoveryPayload], Coroutine[Any, Any, None]] | None   discovery_update = None 
)
Mixin used to handle updated discovery message for entity based platforms.
Initialize the discovery update mixin.

Definition at line 879 of file entity.py.

Member Function Documentation

◆ _async_discovery_callback()

None homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin._async_discovery_callback (   self,
MQTTDiscoveryPayload  payload 
)
private
Handle discovery update.

If the payload has changed we will create a task to
do the discovery update.

As this callback can fire when nothing has changed, this
is a normal function to avoid task creation until it is needed.

Definition at line 963 of file entity.py.

◆ _async_process_discovery_update()

None homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin._async_process_discovery_update (   self,
MQTTDiscoveryPayload  payload,
Callable[[MQTTDiscoveryPayload], Coroutine[Any, Any, None]]  discovery_update,
DiscoveryInfoType  discovery_data 
)
private
Process discovery update.

Definition at line 937 of file entity.py.

◆ _async_process_discovery_update_and_remove()

None homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin._async_process_discovery_update_and_remove (   self)
private
Process discovery update and remove entity.

Definition at line 949 of file entity.py.

◆ _async_remove_state_and_registry_entry()

None homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin._async_remove_state_and_registry_entry ( MqttDiscoveryUpdateMixin  self)
private
Remove entity's state and entity registry entry.

Remove entity from entity registry if it is registered,
this also removes the state. If the entity is not in the entity
registry, just remove the state.

Definition at line 919 of file entity.py.

◆ _cleanup_discovery_on_remove()

None homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin._cleanup_discovery_on_remove (   self)
private
Stop listening to signal and cleanup discovery data.

Definition at line 1132 of file entity.py.

◆ add_to_platform_abort()

None homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin.add_to_platform_abort (   self)
Abort adding an entity to a platform.

Reimplemented from homeassistant.helpers.entity.Entity.

Definition at line 1108 of file entity.py.

◆ add_to_platform_finish()

None homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin.add_to_platform_finish (   self)
Finish adding entity to platform.

Reimplemented from homeassistant.helpers.entity.Entity.

Definition at line 1099 of file entity.py.

◆ async_added_to_hass()

None homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin.async_added_to_hass (   self)
Subscribe to discovery updates.

Reimplemented from homeassistant.helpers.entity.Entity.

Reimplemented in homeassistant.components.mqtt.entity.MqttEntity.

Definition at line 900 of file entity.py.

◆ async_removed_from_registry()

None homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin.async_removed_from_registry (   self)
Clear retained discovery topic in broker.

Reimplemented from homeassistant.helpers.entity.Entity.

Definition at line 1087 of file entity.py.

◆ async_will_remove_from_hass()

None homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin.async_will_remove_from_hass (   self)
Stop listening to signal and cleanup discovery data..

Reimplemented from homeassistant.helpers.entity.Entity.

Reimplemented in homeassistant.components.mqtt.entity.MqttEntity.

Definition at line 1128 of file entity.py.

Member Data Documentation

◆ _discovery_data

homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin._discovery_data
private

Definition at line 887 of file entity.py.

◆ _discovery_update

homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin._discovery_update
private

Definition at line 888 of file entity.py.

◆ _migrate_discovery

homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin._migrate_discovery
private

Definition at line 996 of file entity.py.

◆ _registry_hooks

homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin._registry_hooks
private

Definition at line 894 of file entity.py.

◆ _remove_discovery_updated

homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin._remove_discovery_updated
private

Definition at line 913 of file entity.py.

◆ _removed_from_hass

homeassistant.components.mqtt.entity.MqttDiscoveryUpdateMixin._removed_from_hass
private

Definition at line 890 of file entity.py.


The documentation for this class was generated from the following file: