homeassistant.helpers.entity

An abstract class for entities.

class homeassistant.helpers.entity.Entity[source]

An abstract class for Home Assistant entities.

assumed_state

Return True if unable to access real state of the entity.

async_device_update(warning=True)[source]

Process ‘update’ or ‘async_update’ from entity.

This method is a coroutine.

async_on_remove(func)[source]

Add a function to call when entity removed.

async_registry_updated(old, new)[source]

Handle entity registry update.

async_remove()[source]

Remove entity from Home Assistant.

async_schedule_update_ha_state(force_refresh=False)[source]

Schedule an update ha state change task.

async_set_context(context)[source]

Set the context the entity currently operates under.

async_update_ha_state(force_refresh=False)[source]

Update Home Assistant with current state of entity.

If force_refresh == True will update entity before setting state.

This method must be run in the event loop.

available

Return True if entity is available.

context_recent_time

Time that a context is considered recent.

device_class

Return the class of this device, from component DEVICE_CLASSES.

device_info

Return device specific attributes.

Implemented by platform classes.

device_state_attributes

Return device specific state attributes.

Implemented by platform classes.

entity_picture

Return the entity picture to use in the frontend, if any.

force_update

Return True if state updates should be forced.

If True, a state change will be triggered anytime the state property is updated, not just when the value changes.

hidden

Return True if the entity should be hidden from UIs.

icon

Return the icon to use in the frontend, if any.

name

Return the name of the entity.

schedule_update_ha_state(force_refresh=False)[source]

Schedule an update ha state change task.

That avoid executor dead looks.

should_poll

Return True if entity has to be polled for state.

False if entity pushes its state to HA.

state

Return the state of the entity.

state_attributes

Return the state attributes.

Implemented by component base class.

supported_features

Flag supported features.

unique_id

Return a unique ID.

unit_of_measurement

Return the unit of measurement of this entity, if any.

class homeassistant.helpers.entity.ToggleEntity[source]

An abstract class for entities that can be turned on and off.

async_toggle(**kwargs)[source]

Toggle the entity.

This method must be run in the event loop and returns a coroutine.

async_turn_off(**kwargs)[source]

Turn the entity off.

This method must be run in the event loop and returns a coroutine.

async_turn_on(**kwargs)[source]

Turn the entity on.

This method must be run in the event loop and returns a coroutine.

is_on

Return True if entity is on.

state

Return the state.

toggle(**kwargs) → None[source]

Toggle the entity.

turn_off(**kwargs) → None[source]

Turn the entity off.

turn_on(**kwargs) → None[source]

Turn the entity on.