Calendar: add state (#34681)

This commit is contained in:
c0ffeeca7 2024-09-11 13:32:03 +02:00 committed by GitHub
parent d4ac5bda90
commit 3ce8b1a72b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,7 +21,6 @@ integrations page to find integrations offering calendar entities. For example,
{% include integrations/building_block_integration.md %} {% include integrations/building_block_integration.md %}
## Viewing and managing calendars ## Viewing and managing calendars
Each calendar is represented as its own {% term entity %} in Home Assistant and can be Each calendar is represented as its own {% term entity %} in Home Assistant and can be
@ -34,6 +33,13 @@ the **Add event** button in the lower right corner of the calendar dashboard.
Also see [Actions](#actions) below. Also see [Actions](#actions) below.
## The state of a calendar entity
The state shows whether or not there is an active event:
- On: The calendar has an active event.
- Off: The calendar does not have an active event.
## Automation ## Automation
Calendar [Triggers](/docs/automation/trigger) enable {% term automation %} based on an Calendar [Triggers](/docs/automation/trigger) enable {% term automation %} based on an
@ -149,15 +155,15 @@ directly using {% term actions %}. The actions provided by some calendar {% term
Add a new calendar event. A calendar `target` is selected with a [Target Selector](/docs/blueprint/selectors/#target-selector) and the `data` payload supports the following fields: Add a new calendar event. A calendar `target` is selected with a [Target Selector](/docs/blueprint/selectors/#target-selector) and the `data` payload supports the following fields:
| Data attribute | Optional | Description | Example | | Data attribute | Optional | Description | Example |
| ---------------------- | -------- | ----------- | --------| | ----------------- | -------- | ---------------------------------------------------- | ------------------- |
| `summary` | no | Acts as the title of the event. | Bowling | `summary` | no | Acts as the title of the event. | Bowling |
| `description` | yes | The description of the event. | Birthday bowling | `description` | yes | The description of the event. | Birthday bowling |
| `start_date_time` | yes | The date and time the event should start. | 2019-03-10 20:00:00 | `start_date_time` | yes | The date and time the event should start. | 2019-03-10 20:00:00 |
| `end_date_time` | yes | The date and time the event should end (exclusive). | 2019-03-10 23:00:00 | `end_date_time` | yes | The date and time the event should end (exclusive). | 2019-03-10 23:00:00 |
| `start_date` | yes | The date the whole day event should start. | 2019-03-10 | `start_date` | yes | The date the whole day event should start. | 2019-03-10 |
| `end_date` | yes | The date the whole day event should end (exclusive). | 2019-03-11 | `end_date` | yes | The date the whole day event should end (exclusive). | 2019-03-11 |
| `in` | yes | Days or weeks that you want to create the event in. | "days": 2 | `in` | yes | Days or weeks that you want to create the event in. | "days": 2 |
| `location` | yes | The location of the event. | Bowling center | `location` | yes | The location of the event. | Bowling center |
{% note %} {% note %}
@ -197,10 +203,10 @@ This action populates [Response Data](/docs/scripts/perform-actions#use-template
with calendar events within a date range. It can return events from multiple calendars. with calendar events within a date range. It can return events from multiple calendars.
| Data attribute | Optional | Description | Example | | Data attribute | Optional | Description | Example |
| ---------------------- | -------- | ----------- | --------| | ----------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
| `start_date_time` | yes | Return active events after this time (exclusive). When not set, defaults to now. | 2019-03-10 20:00:00 | `start_date_time` | yes | Return active events after this time (exclusive). When not set, defaults to now. | 2019-03-10 20:00:00 |
| `end_date_time` | yes | Return active events before this time (exclusive). Cannot be used with `duration`. You must specify either `end_date_time` or `duration`.| 2019-03-10 23:00:00 | `end_date_time` | yes | Return active events before this time (exclusive). Cannot be used with `duration`. You must specify either `end_date_time` or `duration`. | 2019-03-10 23:00:00 |
| `duration` | yes | Return active events from `start_date_time` until the specified duration. Cannot be used with `end_date_time`. You must specify either `duration` or `end_date_time`. | `days: 2` | `duration` | yes | Return active events from `start_date_time` until the specified duration. Cannot be used with `end_date_time`. You must specify either `duration` or `end_date_time`. | `days: 2` |
{% note %} {% note %}
Use only one of `end_date_time` or `duration`. Use only one of `end_date_time` or `duration`.
@ -222,12 +228,12 @@ The response data contains a field for every calendar entity (e.g. `calendar.sch
Every calendar entity has a field `events` containing a list of events with these fields: Every calendar entity has a field `events` containing a list of events with these fields:
| Response data | Description | Example | | Response data | Description | Example |
| ---------------------- | ----------- | -------- | | ------------- | ------------------------------------------------- | ------------------- |
| `summary` | The title of the event. | Bowling | `summary` | The title of the event. | Bowling |
| `description` | The description of the event. | Birthday bowling | `description` | The description of the event. | Birthday bowling |
| `start` | The date or date time the event starts. | 2019-03-10 20:00:00 | `start` | The date or date time the event starts. | 2019-03-10 20:00:00 |
| `end` | The date or date time the event ends (exclusive). | 2019-03-10 23:00:00 | `end` | The date or date time the event ends (exclusive). | 2019-03-10 23:00:00 |
| `location` | The location of the event. | Bowling center | `location` | The location of the event. | Bowling center |
This example uses a template with response data in another action: This example uses a template with response data in another action: