Hi guys,
I am struggling very hard to implement peak and offpeak tariff and the prices in Home Assistant.
Went through many topics, tried everything possible I found, but no success.
The thing is, that I need to setup the OFF-PEAK tariff like that (and also I need to change the times like 2-3 time per year depending on the electricity provider who changes the peak - offpeak times):
Working days
00:00:00 - 07:15:00
08:15:00 - 10:15:00
11:15:00 - 13:45:00
14:45:00 - 16:45:00
17:45:00 - 23:59:00
Then it means, that the PEAK tariff will be:
07:15:00 - 08:15:00
10:15:00 - 11:15:00
13:45:00 - 14:45:00
16:45:00 - 17:45:00
So again - the PEAK tariff is:
08:15:00 - 09:15:00
11:15:00 - 12:15:00
14:15:00 - 15:15:00
17:15:00 - 18:15:00
Means that I need the PEAK and OFF-PEAK tariffs to change based on the day and time as described above. In some of the last HA versions I was able to create a daily schedule which can held more times than one. Now it was replaced by the “graphical” schedule and this only works with half hours (30 minutes changes).
Can some of you guys guide me, how to do that? This is one of the last important things I need to have working in HA.
Wow that’s quite a few peak and off peak changes whys it so many ?
I’m guessing you have your energy sensor already and if so have your created the peak and off peak sensors using the utility meter integration.
This template gives true if you’re on peak rates. You’ll need the workday integration and time sensor set up, and you must be on 2022.7 or later for the bool function. Time format is critical in the lists: don’t deviate from hh:mm-hh:mm:
{% set pk = ['07:15-08:15',
'10:15-11:15',
'13:45-14:45',
'16:45-17:45']
if bool(states('binary_sensor.workday_sensor')) else
['08:15-09:15',
'11:15-12:15',
'14:15-15:15',
'17:15-18:15'] %}
{% set tm = states('sensor.time') %}
{{ bool((pk|select('<=',tm~'.'))|map('reverse')|map('truncate',length=5,end='')|map('reverse')|select('>',tm)|list|count) }}
Hej man, nice to see you again :-).
Just tried to copy your code and make the template, but it shows me this error.
I am sure I am doing something wrong…
Well this is just how it is. EON in Czech depending on your tariff makes 20 hours a day off-peak and 4 hours a day peak. And of course, to be more complex, different times on weekends.
That´s why I am desperate at setting this up…
Just talking to Troon and hopefully we will get the solution.
Done - I had to put the workday binary sensor under the meteoalarm binary sensor I already have in the config. Didn´t know they have to be each below other.
They’re the same…? The screenshot shows the template embedded in the sensor, which is what you need. That’ll give you binary_sensor.peak_tariff which will be 'on' at peak time, 'off' otherwise.
And there is also a regular monthly fee paid for the electricity service 488,03 CZK per month.
If it´s possible to somehow add this to every month cost, that would be fine.
But if not or if it´s diffucult, no need to have that.
YES, YES and YES. I made a setup of the prices in the electricity dashboard and seems now everything will start to calculate. Will wait till the evening or tomorrow to see the prices.
For now I would like very much to thank you Troon - solution marked and hearts given!!!
And I have just learned a lot studying the codes and way how to do things…
That template is probably not a good place to start learning . If you can describe, step-by-step, how it calculates whether you’re in a peak period I’ll be very impressed.