A jinja macro to easily find the cheapest block of hours to know when to turn on your dryer (and much more)
If your energy provider uses dynamic pricing, you might want to know when to turn on devices which consume a lot of power. It is relatively easy to find the lowest price on the day, but if it takes 3 hours for your dryer to complete, you might want to find the cheapest block of hours. It could be that the cheapest hour is not even in that block. This macro comes to the rescue!
Funny note 😄 I don't have a dynamic price contract myself. It started as a challenge to myself to get it working, and gradually expanded to what it is now. I do have the Nordpool and ENTSOE integrations installed to test, but I don't have real life scenario's implemented, so I'm also depending on your feedback to improve the macro even further. So please keep sending in issues/questions/other feedback.
In case you are able to reduce your energy bill by using this macro, please consider to buy me a cup of coffee ☕
Installing this macro will not create any entities in Home Assistant. It will only provide you with a custom template which can be used in Jinja templating to create template sensors or template binary sesnors yourself. In documentation you will find more information on how to do this, and some examples of real life configurations.
You need to have Home Assistant 2023.11 or higher installed to use this custom template.
This custom template is compatible with HACS, which means that you can easily download and manage updates for it. Custom templates are available for download in HACS 2.0 and up, and on earlier versions in case experimental features are enabled. When you are on HACS 2.0 or higher or experimental features are enabled you can click the button below to add it to your HACS installation:
For a manual install you can copy the contents of cheapest_energy_hours.jinja
to a jinja file in your custom_templates
folder.
Run the homeassistant.reload_custom_templates
service call to load the file.
See the separate documentation on how to use the macro