Purpose of this component is to provide easily configurable energy management for Home Assistant automations.
During the first phase it supports only to find Nord Pool cheapest hours (or most expensive) per day and automatic calendar creation. Later AIO Energy Management is planned to integrate into solar forecast to get support for solar energy usage.
Read more detailed information at the creatingsmarthome.com blog
-
Restart Home Assistant
or
-
Go to
HACS->Integrations, -
Select
...from upper right corner, -
Select
Custom repositories -
Add
https://github.com/kotope/aio_energy_managementand select Type asIntegration -
Search for
AIO Energy Managementand select it -
Press
Download -
Restart Home Assistant
SSH into Home Assistant and write the following:
cd /config/custom_components
wget -O - https://raw.githubusercontent.com/kotope/aio_energy_management/master/install_to_home_assistant.sh | bash
- Cheapest Hours (or most expensive) - Nord Pool and Entso-E integration support
- Event Calendar
- Service utility
The cheapest hours configuration will create a binary_sensor type entity that will provide timeframe(s) containing percentually the cheapest hours per day.
Binary sensor will have the state 'on' when cheapest hours is active.
Automations can then be set to follow this sensor 'on' state.
The feature supports failsafe to ensure critical devices to run if for some reason Nord Pool price fetch has failed!
Installed and configured Nord Pool integration
Installed and configured Entso-E integration
Installed and configured Nord Pool official integration
- Go to Developer Tools > Actions.
- In the “Service” dropdown, select Nord Pool: Get prices.
- Choose your newly created config entry from the UI.
- Switch to YAML mode.
- Voila! The config_entry ID will be displayed. Copy this value for the next steps. (configuration id is something like '01JPHC0B39ST11081WFZQCKMVC')
Configuration is done through configuration.yaml.
Either nordpool_entity or entsoe_entity must be set, depending on which integration you want to use.
Configuration parameters are shown below:
| Configuration | Mandatory | Description |
|---|---|---|
| nordpool_entity | no | Entity id of the Nord Pool integration |
| entsoe_entity | no | Entity id of the Entso-E integration. This is Entso-E average_price sensor that provides all extra attributes |
| nordpool_official_config_entry | no | Configuration entry id of Nord Pool official integration |
| unique_id | yes | Unique id to identify newly created entity |
| name | yes | Friendly name of the created entity |
| number_of_hours | yes | Number of hours required to get. Can contain entity_id of dynamic entity to get value from e.g. input_number |
| first_hour | yes | Starting hour used by cheapest hours calculation. If used 'starting_today' as true, must be AFTER Nord Pool price publishing. |
| last_hour | yes | Last hour used by cheapest hours calculation |
| starting_today | yes | First_hour should be already on the same day. False if next day calculations only |
| sequential | yes | True if trying to calculate sequential cheapest hours timeframe. False if multiple values are acceptable. |
| failsafe_starting_hour | no | If for some reason Nord Pool prices can't be fetched before first_hour, use failsafe time to turn the sensor on. If failsafe_starting_hour is not given, the failsafe is disabled for the sensor. |
| inversed | no | Want to find expensive hours to avoid? Set to True! default: false |
| trigger_time | no | Earliest time to create next cheapest hours. Format: "HH:mm". Useful when waiting for other data to arrive before triggering event creation. Example: 'trigger_time: "19:00"' ! Deprecated: use trigger_hour instead ! |
| price_limit | no | Only accept prices less than given float value or more than given float value if inversed is used. Note: given hours might be less than requested if not enough values can be found with given parameters. Only supported by non-sequential cheapest_hours. Can contain entity_id of dynamic entity to get value from e.g. input_number |
| trigger_hour | no | Earliest hour to create next cheapest hours. "HH:mm". Useful when waiting for other data to arrive before triggering event creation. Example: 'trigger_hour: 19'. Can contain entity_id of dynamic entity to get value from e.g. input_number |
| calendar | no | Should the entity be added to the calendar. Defaults to true. |
| offset | no | Possible start and end offset. On non-sequential the start offset is only added to first item and end offset to last item. Avg/min/max prices does not take the offset into account. See example below. |
| mtu | no | Requested MTU (15 or 60min). Default 60. If data provider uses 15 mtu and 60 is request by user, the component will calculate mean price for the hour |
| price_modifications | no | Adds price modifications to the prices, e.g. tariffs and/or taxes. Jinja2 template with values 'price' and 'time' available. 'time' is the start datetime of entry, 'price' is the price of entry. Example available in its own section below. |
| retention_days | no | Number of days the calendar will show previous markings. Defaults to one if omitted. |
| area | no | Market area used for price date. Only effective when using Nord Pool official integration. Default area of your official Nord Pool integration configuration will be used if omitted. |
- Total timespan needs to be less or equal to 24 hours - this is to prevent overlapping items.
- last_hour is always tomorrow
The example configuration presents creation of three sensors: one for Nord Pool cheapest three hours, one for Nord Pool most expensive prices, one for Entso-E cheapest hours and final one for Nord Pool cheapest hours with offset
aio_energy_management:
cheapest_hours:
- nordpool_entity: sensor.nordpool
unique_id: my_cheapest_hours
name: My Cheapest Hours
first_hour: 21
last_hour: 12
starting_today: true
number_of_hours: 3
sequential: false
failsafe_starting_hour: 1
- nordpool_entity: sensor.nordpool
unique_id: my_expensive_hours
name: Expensive Hours
first_hour: 0
last_hour: 22
starting_today: false
number_of_hours: 4
sequential: false
failsafe_starting_hour: 1
inversed: true
- entsoe_entity: sensor.entsoe_average_price
unique_id: my_entsoe_cheapest_hours
name: My Entso-E Cheapest Hours
first_hour: 21
last_hour: 10
starting_today: true
number_of_hours: 5
sequential: false
- nordpool_entity: sensor.nordpool
unique_id: my_cheapest_hours_offset
name: My Cheapest Hours With Offset
first_hour: 21
last_hour: 10
starting_today: true
number_of_hours: 5
sequential: True
offset:
start:
hours: 0
minutes: 30
end:
hours: 1
minutes: 15
Price modifications can be used to add additional costs, like tariffs and/or taxes, or modify existing prices. Currently official nord pool provides prices EUR/mWh rather than snt/kWh (at least in Finland), this option can be used to convert data points to snt/kWh.
Please note that price limit and other calculations are done after price modifications.
price_modifications requires Jinja2 template with pre-defined parameters price and time used.
Example below contains official nord pool price modification with night tariff (22-07), conversion to snt/kWh and added electricity tax 25.5%
aio_energy_management:
cheapest_hours:
- nordpool_official_config_entry: 01K07FX4QRHEZW8GHSK3KT1ESY
unique_id: my_cheapest_hours
name: My Cheapest Hours
first_hour: 21
last_hour: 12
starting_today: true
number_of_hours: 3
sequential: false
failsafe_starting_hour: 1
price_modifications: >
{%- set as_snt = price / 10.0 %}
{%- set with_taxes = (as_snt * 1.255) | float %}
{%- if time.hour >= 22 or time.hour <= 7 %}
{{ with_taxes + 3.1 }}
{%- else %}
{{ with_taxes + 5.0 }}
{%- endif %}
Calendar feature will create a new calendar entity to display all upcoming scheduled energy management events. Also please note that the events can't be modified through the calendar, it's for displaying and automation purposes (for now at least).
Configuration required for energy management calendar:
| Configuration | Mandatory | Description |
|---|---|---|
| unique_id | yes | Unique id to identify newly created entity |
| name | yes | Friendly name of the created entity |
aio_energy_management:
calendar:
name: Energy Management
unique_id: energy_management_calendar
AIO Energy Management integration provides a service utility to be used alongside with other components. It supports to clear cached cheapest hours data and reloading integration confguration.
Service utility is provided automatically with the integration and does not need separate configuration.
Will clear stored data for specified cheapest hours configuration. Changes will take effect in next 30s when Home Assistant event loop is run. This is especially useful when trying different parameters for cheapest hours: No longer need to wait until next day for changes to effect.
| Parameter | Description |
|---|---|
| unique_id | unique_id of the item to be cleared. Unique_id should be the same as defined in cheapest_hours configuration entry. |
Will reload whole configuration without needing to restart the whole Home Assistant. Remember to call aio_energy_management.clear_data after changes if needed.
service: aio_energy_management.clear_data
data:
unique_id: my_cheapest_hours
aio_energy_management:
cheapest_hours:
- nordpool_entity: sensor.nordpool
unique_id: my_cheapest_hours
name: My Cheapest Hours
first_hour: 21
last_hour: 12
starting_today: true
number_of_hours: 3
sequential: false
failsafe_starting_hour: 1
- nordpool_entity: sensor.nordpool
unique_id: my_expensive_hours
name: Expensive Hours
first_hour: 0
last_hour: 22
starting_today: false
number_of_hours: 4
sequential: false
failsafe_starting_hour: 1
inversed: true
calendar:
name: Energy Management
unique_id: energy_management_calendar
