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_remove() → None[source]

Remove entity from async HASS.

This method must be run in the event loop.

async_schedule_update_ha_state(force_refresh=False)[source]

Schedule a update ha state change task.

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.

device_class

Return the class of this device, from component DEVICE_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.

remove() → None[source]

Remove entity from HASS.

schedule_update_ha_state(force_refresh=False)[source]

Schedule a 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 an unique ID.

unit_of_measurement

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

update()[source]

Retrieve latest state.

When not implemented, will forward call to async version if available.

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.