Skip to content

Add description for Stookwijzer get_forecast service #37476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: next
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions source/_integrations/stookwijzer.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,81 @@ Additionally, various sensor entities are provided:
- **Air Quality Index**: Sensor containing the air quality index at the selected location.

{% include integrations/config_flow.md %}

## Action `stookwijzer.get_forecast`

This action populates [response data](/docs/scripts/perform-actions#use-templates-to-handle-response-data)
with a mapping of the Stookwijzer advice forecast.

```yaml
action: stookwijzer.get_forecast
target:
config_entry_id: 12345
response_variable: stookwijzer_forecast
```

The response data field contains the `forecast` field.
`forecast` is a list of forecast advice entries at a given time:

| Response data | Description | Example |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
| `datetime` | The time of the forecasted advice. | 2025-01-14T14:00:00+00:00 |
| `advice` | The forecasted advice code. | code_yellow |
| `final` | Indicator whether the advice is final or can still change. | True |

## Examples

{% details "Example template sensor using get_forecast" %}

Example template sensors containing the Stookwijzer forecast for 6 and 12 hours from now.

{% raw %}

```yaml
template:
- trigger:
- trigger: time_pattern
hours: /1
action:
- action: stookwijzer.get_forecast
target:
entity_id: sensor.stookwijzer_advice_code
response_variable: advice_forecast
sensor:
- name: Stookwijzer forecast 6 hours
unique_id: stookwijzer_forecast_6_hours
state: "{{ advice_forecast['forecast'][0]['advice'] }}"
attributes:
final: "{{ advice_forecast['forecast'][0]['final'] }}"
timestamp: "{{ advice_forecast['forecast'][0]['datetime'] }}"
- name: Stookwijzer forecast 12 hours
unique_id: stookwijzer_forecast_12_hours
state: "{{ advice_forecast['forecast'][1]['advice'] }}"
attributes:
final: "{{ advice_forecast['forecast'][1]['final'] }}"
timestamp: "{{ advice_forecast['forecast'][1]['datetime'] }}"
```

{% endraw %}

{% enddetails %}

{% details "Example action response" %}

```yaml
forecast:
- datetime: "2025-02-12T17:00:00+01:00"
advice: code_yellow
final: True
- datetime: "2025-02-12T23:00:00+01:00"
advice: code_yellow
final: True
- datetime: "2025-02-13T05:00:00+01:00"
advice: code_orange
final: False
- datetime: "2025-02-13T11:00:00+01:00"
advice: code_red
final: False
```

{% enddetails %}