Add event groups (#28653)

This commit is contained in:
Franck Nijhof 2023-08-24 12:49:45 +02:00 committed by GitHub
parent fb2f61973f
commit 01c1f7ec9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ ha_category:
- Binary Sensor - Binary Sensor
- Cover - Cover
- Fan - Fan
- Event
- Helper - Helper
- Light - Light
- Lock - Lock
@ -23,6 +24,7 @@ ha_config_flow: true
ha_platforms: ha_platforms:
- binary_sensor - binary_sensor
- cover - cover
- event
- fan - fan
- light - light
- lock - lock
@ -38,7 +40,7 @@ The group integration lets you combine multiple entities into a single entity. E
This can be useful for cases where you want to control, for example, the This can be useful for cases where you want to control, for example, the
multiple bulbs in a light fixture as a single light in Home Assistant. multiple bulbs in a light fixture as a single light in Home Assistant.
Home Assistant can group multiple binary sensors, covers, fans, lights, locks, media players, switches as a single entity, with the option of hiding the individual member entities. Home Assistant can group multiple binary sensors, covers, events, fans, lights, locks, media players, switches as a single entity, with the option of hiding the individual member entities.
{% include integrations/config_flow.md %} {% include integrations/config_flow.md %}
@ -70,6 +72,11 @@ In short, when any group member entity is `open`, the group will also be `open`.
- Otherwise, the group state is `open` if at least one group member is `open`. - Otherwise, the group state is `open` if at least one group member is `open`.
- Otherwise, the group state is `closed`. - Otherwise, the group state is `closed`.
### Event groups
- The group state is `unavailable` if all group members are `unavailable`.
- Otherwise, the group state is the last event received from any group member.
### Fan groups ### Fan groups
In short, when any group member entity is `on`, the group will also be `on`. A complete overview of how fan groups behave: In short, when any group member entity is `on`, the group will also be `on`. A complete overview of how fan groups behave:
@ -149,6 +156,20 @@ cover:
- cover.living_room_window - cover.living_room_window
``` ```
Example YAML configuration of an event group:
```yaml
# Example configuration.yaml entry
event:
- platform: group
name: "Remote events"
entities:
- event.remote_button_1
- event.remote_button_2
- event.remote_button_3
- event.remote_button_4
```
Example YAML configuration of a fan group: Example YAML configuration of a fan group:
```yaml ```yaml
@ -376,13 +397,13 @@ Old style groups can calculate group state with entities from the following doma
When member entities all have a single `on` and `off` state, the group state will be calculated as follows: When member entities all have a single `on` and `off` state, the group state will be calculated as follows:
| Domain | on | off | | Domain | on | off |
|-------------------|----------|----------| | -------------- | -------- | -------- |
| device_tracker | home | not_home | | device_tracker | home | not_home |
| cover | open | closed | | cover | open | closed |
| lock | unlocked | locked | | lock | unlocked | locked |
| person | home | not_home | | person | home | not_home |
| media_player | ok | problem | | media_player | ok | problem |
When a group contains entities from domains that have multiple `on` states or only use `on` and `off`, the group state will be `on` or `off`. When a group contains entities from domains that have multiple `on` states or only use `on` and `off`, the group state will be `on` or `off`.
@ -394,14 +415,14 @@ These groups can still be in templates with the `expand()` directive, called usi
This integration provides the following services to modify groups and a service to reload the configuration without restarting Home Assistant itself. This integration provides the following services to modify groups and a service to reload the configuration without restarting Home Assistant itself.
| Service | Data | Description | | Service | Data | Description |
| ------- | ---- | ----------- | | -------- | ----------------- | ----------------------------------------------------------------------------- |
| `set` | `Object ID` | Group id and part of entity id. | `set` | `Object ID` | Group id and part of entity id. |
| | `Name` | Name of the group. | | `Name` | Name of the group. |
| | `Icon` | Name of the icon for the group. | | `Icon` | Name of the icon for the group. |
| | `Entities` | List of all members in the group. Not compatible with **delta**. | | `Entities` | List of all members in the group. Not compatible with **delta**. |
| | `Add Entities` | List of members that will change on group listening. | | `Add Entities` | List of members that will change on group listening. |
| | `Remove Entities` | List of members that will be removed from group listening. | | `Remove Entities` | List of members that will be removed from group listening. |
| | `All` | Enable this option if the group should only turn on when all entities are on. | | `All` | Enable this option if the group should only turn on when all entities are on. |
| `remove` | `Object ID` | Group id and part of entity id. | `remove` | `Object ID` | Group id and part of entity id. |
| `reload` | `Object ID` | Group id and part of entity id. | `reload` | `Object ID` | Group id and part of entity id. |