Yes, I wanted to say you probably need to provide the attributes or keys. But I’ll look into it to make prevent this error and return a more informative error message
thanks for your work, this is a really helpful macro for those new hourly price power suppliers
I have added a new version, 5.1.0 which now supports the data as provided by Tibber without the need for a template sensor.
v5.1.0
IMPROVEMENTS
- This version adds support for data sources which don’t provide the date and time in the list with prices. 2 new parameters are added:
datetime_in_data
(defaults totrue
) anddata_minutes
(defaults to60
, only used whendatetime_in_data
is set tofalse
). More information can be found in the documentation
What’s Changed
- Add support for data source without datetime by @TheFes in Add support for data source without datetime by TheFes · Pull Request #107 · TheFes/cheapest-energy-hours · GitHub
Full Changelog: Comparing v5.0.3...v5.1.0 · TheFes/cheapest-energy-hours · GitHub
Hi TheFes and thanks a lot for a great job. I have both “energi_data_service” and “nordpool” installed. I need a solution for battery charge when low price. How can I make sensors for cheapest and most expensive hours for night and day (i.e. 22:00 - 06:00 and 06:00 - 22:00). Period should be 3 or 4 hours?
There are examples in the documentation.
Can you show what you already tried?
I have tested this template:
I have got only the value of the chepest energy hour not a perion when these hourse are. And I have maked a sensor:
use mode='start'
(which is the default) to get the start date and time of that period
1hour is your timezone. It starts 1:00 zulu. In your timezone it is 2:00.
Start for 3 hours period at 2 o’clock
mode='start', cheapest=false
This is all explained in the documentation
Yes I see, but excuse me for my low programming understanding. Thanks for help. I will try make some automatisation.
I have tried to make a new sensor for macro from Nordpool. When I put this in the template editor it looks like that:
Is it correct?
Should it be placed in sensors.yaml?
Sorry, what are you trying to do here?
The sensors provided by the Nordpool custom integration already provide the data needed for the macro. There is no further template sensor required to use the macro if you use the Nordpool integration.
Regarding your question:
- Your sensor is not outputting anything for the
today
attribute. It is only setting some variables - The code is in the modern template sensor format, and can’t be placed in
sensor.yaml
as it is using thetemplate
integration and not thesensor
integration. The way you have it now it should be placed directly in your configuration.yaml. You could create atemplate.yaml
and incldue it from your configuration.yaml. In that case you can paste it in there without the first line (withtemplate:
). I will be best to remove 2 spaces on each line as well, to avoid issues when you add more template entities.
Do you mean I can use Nordpool instead for energi_data service without any adjustment? Like this:
{{ cheapest_energy_hours(‘sensor.nordpool_kwh_se4_sek_2_00_0’, hours=3, end=‘10:00’, mode=‘max’) }}
Yes, you can use the nordpool sensor like that.
Hi @TheFes , Great Macro you have created. Just started to play with it and use it to show the lowest and highest price of the day etc.
My Wife wants me to put on the display which hours she is “allowed” to do laundry without it being to expensive. I noticed in the documentation about lists, how would I go and create a list of datetime, price values for the entire day to show when the price is below e.g 3.00.
Thanks in advance.
The macro is intended to find connected least expensive hours. If you want to display all hours below a certain price, you can just use the raw data from the attribute of your price sensor.