The "entities" of Home Assistant: what they are and how they are used

5 minutes of reading

An important premise: anyone is willing to use Home Assistant which proprio personale HUB need to do proprior to the concepts expressed on this page. This cannot be used HUB without understanding clearly the concept of entity: it is in fact a pivotal concept.

What is an entity

Le entity they are gods abstract objects equipped with a proman nature, Of a proprio state, one or more attributes and of services connected to them. Imagine, to use a metaphor, like LEGO bricks.

Let's try to explain ourselves using examples.

Let's assume we have (without entering into the merits of How) added a switch to the configuration of Home Assistant.

This switch will itself be entity.
Let's say his name is "Bathroom fan heater". On the frontend of Home Assistant the switch appwill appear as follows:

Switch Home Assistant

Returning to the features described above:

  • la nature of this entity will be, for theappanointed, of switch or, as in language probefore Home Assistant"Switch";
  • lo state of this type of entity has two conditions, "on" and "off", For theappgreasy on e turned off;
  • the attributes they vary according to the technology through which this switch was inserted in the configuration, the “How”Omitted in the beginning of the example. An attribute typically found in almost all entities is the "friendly_name", Or"icon", Or many others;
  • i services also vary based on the technology used: typical services connected to a type entity "Switch" I'm "turn_on","turn_off","toggle", Respectively switch on, switch off, is inverted state.

Another example.
Let us consider the case of having integrated a thermal sensor:

  • its nature, is that of "Sensor";
  • his state contains the thermal reading (typically a decimal number);
  • the attributes they vary, as always, based on the technology and the nature of the component: typically in a sensor of this kind we expect to find at least “unit_of_measurement"(The unit of measurement, C or F) and the omnipresent"friendly_name";
  • i services vary, depending on the technology used and the nature of the component. In the case of sensors (“Sensors "), there are no services.

In essence, every accessory / component / domotic device integrated on Home Assistant is rappresentato by one or more entities. One or more, certainly: while a single switch could be integrated (based on technology) through a single entity, more complex devices could be exposed to Home Assistant as a set of entities of different nature.

A home automation thermostat could be rappresented by an entity of type "Climate” (for managing the heating system on / off functions) and an entity of type "Sensor” which contains, in its state, the ambient temperature detected by the thermostat itself. BRIDGE/Gateway like that of the line Xiaomi "Smart Home” (to which innumerable different sensors and actuators are connected directly) is seen as an entity of type "Light” plus a whole series of entities that rappthey are the components connected to it.
And so on.

Told in this way the equivalence would seem evident home automation component = entity, but is not so.

In fact they are also considered as entities (of a specific nature) groups, automations, the script, scenes, areas (and other): any component Home Assistant has consideration in entities defined within the prooperating environment.

These entities also obviously have a status, attributes, related services.

Per esempio automation has:

  • la nature of "Automation";
  • lo state "On" or "off" (or if it is operational or not);
  • attributes such as "last_triggered"(Date and time of the last time it was executed), or"hidden”(To hide it from the frontend etc;
  • services internal automation called "State Object".

More details on automations they are available here.

I groups ("Group") are interesting entities: group, For the 'appanointed, entities of a different nature in order to be viewed in this way at the frontend; where the nature of the entities contained in a group is homogeneous (eg. all "Light"), The status of the group entity will assume the status"off"When all the lights are in state"off", is "on"When even one is"on"

Let's assume a group that groups only type entities "Device Tracker"(To geographically track the tenants' position): the status of this entity will be"not_home"When all the grouped entities have been different from"home", And will have"home" when at least one has a prowas the same as "home".

Nb We also dedicated an ad hoc card to the groups:

The "groups" of Home Assistant: what they are and how they are used

Integrations and entities

Once it happens the logic of entities it is easy to understand how, once you have "translated" an accessory / component / domotic device into one or more of these objects, you are there well over half of the work. Once one or more working entities are obtained, it will be possible unconcerned of the "physical" aspects of the profirst domotica to take an interest, focus on the "logical" ones.

Great variation of this concept is, for example, in domotizing something that is not domotic. Let's assume that you make a traditional air conditioner domotic using an infrared emitter: once well configured Home Assistant we will obtain an entity of the HVAC type (cited above): at this point we will no longer be interested in the physical aspect of the question, but we will limit ourselves to command and interrogate the entity through its state, his attributes and its services.

When, on inDomus, describing a home automation component we focus on the theme "home automation integration", what we do is try to understand how simply this component can be translated into one or more entities presso Home Assistant (or others HUB).

On the very important issue of integration we recommend reading the following sheet:

The various ways of integrating components and services with Home Assistant


The entities are defined by a name composed of a prefix - given by the type of component to which the integration platform belongs (eg. "Switch","Light","Climate"Etc.) - and from suffix - given by the name of the entity, defined in the configuration.

Let's assume you have registered an LED light through the platform Flux LED / Magic Light:

  - platform: flux_led
        name: LED 1
        mode: "rgbw"

The name of the resulting entity will be: light.led_1 (note how the eventuai spaces are replaced by a "_")

List of entities

Home Assistant make available, on profirst frontend, an ad hoc page at which all the entities present are listed detected at startup. This page is available by clicking on this symbol:

Home Assistant States - List of entities

The page is called "States" as there are, in addition to the various entities, also all the relative states and attributes (and relative values).


In addition to the intuitive use at the frontend, entities can be used (very precisely) even in automations, scripts, scenes, etc.

The interesting and valuable thing is that an entity, once defined in the configuration, can be used in concert with other entities, completely abstracting from what the physical source of the entities is. In practice entities connected to different physical devices (of lines, technologies and prodifferent producers) can collaborate on the same level.

A striking example is given by the platform "Generic Thermostat" (daughter of the component "Climate") Which allows to define in configuration a thermostat type entity (virtual) which takes the typical decisions of a thermostat (switch on the heating based on a thermal threshold) starting from the thermal reading present in the state of another entity (of type "Sensor") And coming to set" on "/" off "the status of a type entity"Switch”, Which operates the heating system downstream (see proad hoc jet).


In the automation field the entities they are the daily bread: can be used as trigger (or use a state and / or one or more attributes to trigger automation) and / or how condition (or verify a status / attribute to validate the triggered automation) and / or how action (or change the status of one or more entities against the execution of the automation itself.

An example:

- alias: "Risveglio"
  - platform: time
    at: '07:00:00'
  - condition: state
    entity_id: group.famiglia
    state: 'home'
  - service: light.turn_on
    entity_id: light.sala

At 7 in the morning it is verified that the entity "group.famiglia"Has been"home", At this point (if the condition is verified) the service is used"turn_on"For the type entity"Light"Call"light.sala"

Obviously, the "Automation" type entity thus created will be called "automation.risveglio"

Understanding the component-platform-entity logic of Home Assistant

Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.

inDomus telegram channel