
Home Assistant: What’s new in AIO Energy Management 0.3.x and 0.4.0
The AIO Energy Management integration for Home Assistant has been slowly, but steadily improving. Since I didn’t publish an article for version 0.3.0, let’s explore the changes from v0.3.x to v0.4.0 and delve into practical usage examples of the new features.
If you are unfamiliar with the AIO Energy Management integration, go check the previous articles here.
New attributes (v0.3.3)
Version 0.3.3 introduced several new read-only attributes, enhancing automation and information retrieval. These attributes include minimum, maximum, and mean prices, specifically calculated from the current cheapest hours sequence. For instance, you can determine the mean price of a set number of cheapest hours. This allows for direct comparison with the full-day average, highlighting potential cost savings by utilizing the cheapest hours.
Example Use Case: Compare the mean price of your five cheapest hours to the overall daily average to quantify potential savings.

New service to clear cached data (v0.3.2)
Previously, configuration changes required users to wait until the next day for updated flexible energy prices. Now, the AIO Energy Management service clear_data
allows immediate data flushing for a selected sensor.
This service can be invoked through automations or the developer tools’ “Services” section. The unique_id
parameter of the sensor (specified during configuration) is mandatory.
Example Service Call:
service: aio_energy_management.clear_data
data:
unique_id: my_cheapest_hours
New configurations
Price limit (v0.3.0 – v0.3.1)
Initially introduced as max_price
in v0.3.0, this was quickly renamed to price_limit
in v0.3.1 for clarity, especially regarding inverted functionality (e.g., finding the most expensive hours).
The price limit is valuable for restricting cheapest hours usage to periods below a specific price. For example, I use it to heat my outdoor hot tub only when prices are below 5 cents/kWh. Note that if the price limit isn’t met, heating might be skipped, which is acceptable for my hot tub’s heat retention.
The price limit can also reference an entity’s value. Simply enter the entity_id
in the price_limit
variable (e.g., price_limit: input_number.example_entity
). Ensure the value is a decimal number (e.g., 5.0
).
Example Configuration:
cheapest_hours:
- nordpool_entity: sensor.nordpool
unique_id: cheapest_hours_hot_tub
name: Cheapest Hours Hot Tub
first_hour: 0
last_hour: 23
starting_today: false
number_of_hours: 5
sequential: false
max_price: 5.0
Trigger Hour (v0.3.0 – v0.3.1)
Implemented in v0.3.0 and refined in v0.3.1, the trigger hour delays calculations until specific conditions are met.
Without a trigger hour, calculations occur immediately after flexible energy prices are published. The trigger hour enables calculations at a predetermined time, such as evening, when usage patterns are known. This is useful for adjusting number_of_hours
based on daily consumption.
trigger_hour
accepts an integer, representing the hour when calculations begin.
Example Configuration:
cheapest_hours:
- nordpool_entity: sensor.nordpool
unique_id: cheapest_hours_water_boiler
name: Cheapest Hours Water Boiler
first_hour: 21
last_hour: 12
starting_today: true
number_of_hours: sensor.water_heater_number_of_hours
sequential: false
failsafe_starting_hour: 1
trigger_hour: 21
Note: The trigger hour will be further refined in future releases to accept hour and minute sub-parameters.
Enable/disable calendar (0.3.3)
This enhancement allows disabling calendar entries for sensors used e.g. solely as automation helpers. Add calendar: false
to the sensor configuration. By default, sensors are displayed on the calendar.
Example Configuration:
cheapest_hours:
- nordpool_entity: sensor.nordpool
unique_id: my_cheapest_hours_helper
name: Just a helper cheapest hours
first_hour: 21
last_hour: 12
starting_today: true
number_of_hours: 3
sequential: false
trigger_hour: 21
calendar: false
Offset (v0.4.0)
The offset feature adds buffers to the start or end of the cheapest hours sequence. This is useful for accommodating variable usage. For example, adding a buffer to the end of a water heating sequence to ensure sufficient heating.
Important Considerations:
- If the end offset extends past the last hour, the expiration time is extended, potentially causing sequence overlaps on the calendar. This does not affect binary sensor functionality.
- Min, Max, and mean price attributes do not account for offsets.
- When using non-sequential, start offset only happens at the first selected hour, and end offset at the last selected hour.
Example Configuration:
cheapest_hours:
- nordpool_entity: sensor.nordpool
unique_id: my_cheapest_hours_sensor_offset
name: My Cheapest Hours Official Offset
first_hour: 0
last_hour: 23
starting_today: false
number_of_hours: 3
sequential: True
failsafe_starting_hour: 22
offset:
start:
hours: 0
minutes: 30
end:
hours: 1
minutes: 2
Official Nord Pool Integration Support (v0.4.0)
Version 0.4.0 introduces compatibility with the official Home Assistant Nord Pool integration. This integration uses a service to fetch data, requiring the configuration entry ID instead of an entity ID.
To obtain the configuration entry ID, navigate to “Devices & Services” -> “Nord Pool integration” -> “Entities” and copy the last part of the browser URL.


Example Configuration:
cheapest_hours:
- nordpool_official_config_entry: 01JPHC0B39ST11081WFZQCKMVC
unique_id: my_cheapest_hours_sensor_official
name: My Cheapest Hours Official
first_hour: 22
last_hour: 10
starting_today: true
number_of_hours: 3
sequential: False
failsafe_starting_hour: 22
The official Nord Pool integration functions similarly to the custom component or Entso-E integrations.
Hi,
Thanks for sharing this excellent work! I installed the plugin via HACS and configured the configuration.yaml
# AIO Energy Management
aio_energy_management:
cheapest_hours:
– entsoe_entity: sensor._average_electricity_price
unique_id: my_entsoe_cheapest_hours
name: Mijn Entso-E goedkoopste uren
first_hour: 21
last_hour: 10
starting_today: true
number_of_hours: 5
sequential: false
calendar:
name: Energy Management
unique_id: energy_management_calendar
Currently the status of both these entities are “off”.
Could you give some hints on:
– How can I see which 5 hours are selected by the plugin?
– What are goog setting for first_hour and last_hour when using the ENTSO-E prices plugin?
Best regards and thanks for all the good work!
Easiest way to view selected hours is definitely to check the calendar 🙂
Other way is to open the binary_sensor attributes and see the ‘list’ variable.
good settings for first_hour and last_hour definitely depends of your use case.
Few examples here:
– I’m heating my water heater every night so that I have enough water on the morning. first_hour: 21, last_hour: 10, starting_today: true
– I’m heating my outdoor hot tub on absolute cheapest hours, no need to heat at specific time. So I’ve set it during full day. first_hour: 0, last_hour: 23, starting_today: false
Just keep in mind that when using starting_today: true, you should not have the first_hour before prices are published.
Also it does not matter if you are using Entso-e, Nord Pool custom component or Nord Pool official integration. They have the exact same features.
I’m sorry regarding my second question.
I didn’t checked your first post very well.
I currently see the kalender created “Energy management”. But it’s completely empty. When will it populate the 5 cheapest hours?
best regards
The calendar should populate as soon as prices come available (unless trigger_hour is used).
So, most probably something wrong with your setup. Have you looked if there’s any errors in the log?
Looking at your configuration, the entso-e entity seems a bit odd.
– entsoe_entity: sensor._average_electricity_price
Please double check the entsoe_entity name and then check the logs 🙂
Thanks Tony for you fast responses. Really great.
My ENTSO-E average price entity has my name in it (it’s the mailadres used when registering for the the API for the ENTSO-E transparency platform) so I removed it when posting it on your public blog. But the entity-ID is correct the entity is working (I can see the pricing data).
I checked the log file and I see some errors:
Error 1
Update for binary_sensor.mijn_entso_e_goedkoopste_uren fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 960, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 1318, in async_device_update
await self.async_update()
File “/config/custom_components/aio_energy_management/cheapest_hours_binary_sensor.py”, line 96, in async_update
await self._async_operate()
File “/config/custom_components/aio_energy_management/cheapest_hours_binary_sensor.py”, line 269, in _async_operate
cheapest = calculate_non_sequential_cheapest_hours(
today,
……
self._data.get(“active_price_limit”),
)
File “/config/custom_components/aio_energy_management/math.py”, line 142, in calculate_non_sequential_cheapest_hours
raise ValueNotFound
custom_components.aio_energy_management.exceptions.ValueNotFound
Error 2:
Logger: custom_components.aio_energy_management.math
Bron: custom_components/aio_energy_management/math.py:139
integratie: AIO Energy Management (documentatie)
Eerst voorgekomen: 15:27:06 (618 gebeurtenissen)
Laatst gelogd: 20:35:36
Data provided for calculation has invalid amount of values. This is most probably error in data provider
Any ideas?
Hi and thanks for the logs.. there are several possibilities why this can happen:
1. Running version prior to 0.4.0 on summer time change, but according to your logs and line numbers it looks like you are already on 0.4.0
2. There’s a bug in 0.4.0 summer time conversion when using Entso-E. Unfortunately I forgot to take the logs from Entso-E data yesterday to see if the data was what I expected.
3. Your Entso-E provides wrong values. The calculations need both today and tomorrow values. Did you see both on your Entso-E entity?
So, what I suggest is to try again today and see if it still reproduces.
Then please copy entso-e attributes using developer tools and paste in here so I can try to reproduce the issue with exact same date.
You can do it by going to developer tools -> template and add ‘{{ states.sensor.average_electricity_price.attributes }}’ to the left column (of course change the entity id to your own.) Then you should see attributes on the right column, so copy those in here.
..and obviously this can be done after flexible prices are published.
Hi Toni, thanks for helping out.
I did a fresh install, so I installed 0.4.0 via HACS.
Regards question 3. Yesterday I did see both values of yesterday and today.
Currently (12:01 hour Central European Summer Time) I checked the ENTSO-E entity and there are no values for tomorrow yet. I’ve read that the prices gates are closed at 12:00 and they publish within 1 hour after the gates are closed. So probably I will see the prices in the entity between 13:00-14:00 hours.
If it reproduces I’ll copy the ENTSO-E attributes for further analyses. Great thanks for helping out.
In het meanwhile, enjoy the coffee;).
BTW: there are no formatting options in this blog so all text is dumped without formatting.
Best regards
Got it! Thanks for the coffee!
Please send me the attributes by mail to creatingsmarthome (at) gmail.com. Easier that way so no need to spam the comment section. 🙂
…and note to myself: Find a proper wp plugin to actually be able to use proper formatting on comments 🙂
I was able to reproduce the issue using entso-e. I’ll look into it now. It is most probably issue with latest 0.4.0 release when using entso-e, but let’s see.
I forked an issue to the GitHub project page: https://github.com/kotope/aio_energy_management/issues/75
Let’s continue there 🙂