Skip to content

Commit

Permalink
Merge pull request #31 from jdejaegh/update-readme
Browse files Browse the repository at this point in the history
Update README
  • Loading branch information
jdejaegh committed May 20, 2024
2 parents f5ebf31 + e55a2e5 commit 7ff9705
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Jules Dejaeghere
Copyright (c) 2023-2024 Jules Dejaeghere

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,22 @@ Although the provider is Belgian, the data is available for Belgium 🇧🇪, Lu

## Installing via HACS

[![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=jdejaegh&repository=irm-kmi-ha&category=integration)

or

1. Go to HACS > Integrations
2. Add this repo into your [HACS custom repositories](https://hacs.xyz/docs/faq/custom_repositories/)
3. Search for IRM KMI and download it
4. Restart Home Assistant
5. Configure the integration via the UI (search for 'IRM KMI')

## Set up the integration

[![Open your Home Assistant instance and start setting up a new integration.](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=irm_kmi)

or

1. Configure the integration via the UI (search for 'IRM KMI')


## Features
Expand All @@ -20,8 +31,10 @@ This integration provides the following things:

- A weather entity with current weather conditions
- Weather forecasts (hourly, daily and twice-daily) [using the service `weather.get_forecasts`](https://www.home-assistant.io/integrations/weather/#service-weatherget_forecasts)
- Short-term rain forecasts using the radar data using the [custom service `ìrm_kmi.get_forecasts_radar`](#custom-service-irm_kmiget_forecasts_radar)
- A camera entity for rain radar and short-term rain previsions
- A binary sensor for weather warnings
- A sensor with the timestamp for the start of the next warning
- Sensors for active pollens

The following options are available:
Expand Down Expand Up @@ -74,6 +87,12 @@ Mapping was established based on my own interpretation of the icons and conditio

## Warning details

Warnings are represented with two sensors:
- a binary sensor showing if any warning is currently active
- a timestamp sensor with the start time of the next warning (if any, else `unknown`)

### Binary sensor for ongoing warnings

The warning binary sensor is on if a warning is currently relevant (i.e. warning start time < current time < warning end time).
Warnings may be issued by the IRM KMI ahead of time but the binary sensor is only on when at least one of the issued warnings is relevant.

Expand Down Expand Up @@ -109,6 +128,15 @@ The following table summarizes the different known warning types. Other warning
The sensor has an attribute called `active_warnings_friendly_names`, holding a comma separated list of the friendly names
of the currently active warnings (e.g. `Fog, Ice or snow`). There is no particular order for the list.

### Timestamp sensor for upcoming warnings

The state is the start time of the earliest next warning, if any; else `unknown`.

The sensor has two additional attributes:
- `next_warnings`: a list of all the upcoming warnings, with the same data as the `warnings` attribute of the binary sensor (see above)
- `next_warning_friendly_names` holding a comma separated list of the friendly names of the currently active warnings (e.g. `Fog, Ice or snow`). There is no particular order for the list.


## Pollen details

One sensor per pollen is created and each sensor can have one of the following values: active, green, yellow, orange,
Expand All @@ -121,6 +149,29 @@ The exact meaning of each color can be found on the IRM KMI webpage: [Pollen all
This data sent to the app would result in oak and ash have the 'active' state, birch would be 'purple' and alder would be 'green'.
All the other pollens would be 'none'.

## Custom service `irm_kmi.get_forecasts_radar`

The service returns a list of Forecast objects (similar to `weather.get_forecasts`) but only data about precipitation is available.
The data is taken from the radar forecast: it is useful for very short-term rain forecast.

The service can optionally include data from the past (like shown on the radar).

Here is an example of service call:

```yaml
service: irm_kmi.get_forecasts_radar
target:
entity_id: weather.home
data:
include_past_forecasts: true
```
The data is optional and defaults to `false`.

Even when `include_past_forecasts` is `false`, the current 10 minutes interval is returned so the first item in the
response is in the past (at most 10 minutes in the past). This can be useful to determine if rain is currently falling
and how strong it is.

## Disclaimer

This is a personal project and isn't in any way affiliated with, sponsored or endorsed by [The Royal Meteorological
Expand Down
4 changes: 4 additions & 0 deletions custom_components/irm_kmi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ async def _api_wrapper(
headers: dict | None = None,
) -> any:
"""Get information from the API."""
if headers is None:
headers = {'User-Agent': 'github.com/jdejaegh/irm-kmi-ha'}
else:
headers['User-Agent'] = 'github.com/jdejaegh/irm-kmi-ha'

try:
async with async_timeout.timeout(60):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/irm_kmi/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ get_forecasts_radar:
domain: weather
fields:
include_past_forecasts:
required: true
required: false
default: false
selector:
boolean:
Binary file modified img/sensors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7ff9705

Please sign in to comment.