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

3 minutes of reading

The groups of Home Assistant they are special entity dedicated to grouping of multiple entities present in the configuration.

Such groupings they were used - before the advent of the new interface Lovelace (starting from the version 0.86 of HA) - as a tool not only to define appof the "Group" entities, but also to visualize, grouped together, multiple entities on the web user interface.

groups

Once deprecated this approccio (the interface is in fact now decoupled from the configuration of theHUB), the groups have returned to enslave only their main function, or define the over-entities that rappresent the "global" status of the entities in them grouped.

Like any entity, in fact, those of the "Group" type have a profirst state, which is influenced by the state of the entities grouped in them - provided they are homogeneous.

By homogeneous we mean "of the same type". Group a type entity "Light"And a type"Device Tracker"Makes little sense (however feasible), while it certainly makes sense to group together a set of"Light" Is a set of "Device Tracker”(Or other types). The groups can in turn group other groups.

Taking a practical example: create an entity of type "Group" containing only entities of type "Light"Causes it inherit services of the types of entities grouped in it (eg light.turn_on light.turn_off); causes its state to be "on" where at least one light included in the grouping both "on", is "off" when all let them beoff". Finally, controlling a change of status of the "Group" entity instead causes all the lights to react accordingly: if in "on", All will light up, if"off"All will go out.

Default groups

Home Assistant, at startup, between the various default entities that provvede to configure it defines some of the "Group" type implicitly containing entities listed in the attribute field "entités". These groups are convenient for administration and management of automations, script, scenes as well as the Lovelace interface.

Some typical predefined groups are:

  • group.all_light (grouping of all type entities "Light");
  • group.all_switches (grouping of all type entities "Switch");
  • group.all_automations (grouping of all type entities "Automations");
  • group.all_scripts (grouping of all "Script" type entities);

As always, the complete list on propetition for Home Assistant it is available on the complete list of entities ("Developer Tools / States").

Define them propri

To define propri groups is rather elementary. It is in fact sufficient to add a block of this type in the configuration:

group:
  luci_cucina:
    name: Luci cucina
    entities:
      - light.cucina1
      - light.cucina2
  luci_camera:
    name: Luci camera
    entities:
      - ligh.camera
      - light.comodino1
      - light.comodino2
  switch_impianto:
    name: Impiantistica
    entities:
      - switch.pompa
      - switch.interruttore_cantina

This type of configuration defines three group type entities:

  • group.luci_cucina
  • group.luci_camera
  • group.switch.impianto

Typical use: "Device Traker "

One of the first groups that is usually created is the one that rappresents "the tenants" who frequent the environment controlled by Home Assitant, tenants rappobviously resent by propri personal smartphones.

As sappiamo, "Device Tracker”Is a component that generates entities which rappresent the presence status of a specific person; this presence is borrowed based on the component platform of the component "Device Tracker”Implemented to track the person.

Each type entity "Device Tracker"Has a state that rappresents the presence status of the person to whom it is associated, typically "home"Or"not_home"

Well: creating a "family" group can be a great idea:

group:
  famiglia:
    name: Famiglia
    entities:
      - device_tracker.marco
      - device_tracker.daniela
      - device_tracker.giorgia

The utility lies in the fact that the resulting entity group.famiglia will assume state "home" when at least one of people turn up at home, and “not_home" when all turn out.

This is extremely useful when the change in status of the "Group" entity (from "home” a “not_home"And / or from"not_home” a “home") Has been used as trigger inside automations: this would allow, for example, the automatic execution of actions against the exit / return of tenants (lights management, alarms, closing / opening water and gas supply and so on), one of the most useful things in personal home automation.


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.


Please comment below