How to get cheapest energy intervals using Home Assistant and IFTTT

Michael Saparov
3 min readMay 15, 2020

This post sums up my current knowledge of home automation and Home Assistant. Still a lot to learn but I’d like to share this one.

Story: I switched to Octopus Agile tariff where the electricity prices vary every 30 minutes and wanted to know when to run my appliances, e.g. dishwasher or washing machine to get the most out of it.

Solution: To get the cheapest time slots I used AppDaemon 4 add-on with octoblock Python app running inside it https://github.com/badguy99/octoblock

Make sure you add the timezone to the add-on configuration so you get the correct time out of it

After that I added the sensors to the Lovelace UI. Used the custom secondary info card as well https://github.com/custom-cards/secondaryinfo-entity-row

Easy, right?

Problem: When I want to start a dishwasher I need to open an iPhone app which was just too complicated, I think we all agree on this. I also have a Google Assistant set up. If only I could ask it when to run my dishwasher…

Solution: Using IFTTT I created an applet where IF is Google Assistant phrase “What is the best time to run a dishwasher” and THEN is a Webhook with JSON formatted content.

I use Nabu Casa cloud to get the webhook url for my Home Assistant instance. $5 per month for out of the box remote UI and easy Google Assistant integration. Also supports the HA developers hence worth every cent.

What should this webhook trigger? I use Node Red add-on for all my home automations. Using events: all node I search all incoming events for ifttt_webhook_received event type.

Then using the switch node I route the flow depending on the message received. In this case it is octopus_4h set up earlier in IFTTT

Then using current state node I get the relevant sensor’s state and pass that on to function node where it calculates how many hours left until the cheapest time slot. Substring method is used to remove ‘BST’ from the end of the octoblock output which was ‘YYYY-MM-DDTHH:MM:SS BST

Then finished it off with a call service node which passed the message to the speaker via the google_translate_say service. The whole flow looks like this:

Now I can ask the assistant and straight away know how many hours of a delay to put when starting the dishwasher.

https://youtu.be/nquq0G7MgLM

I tend to do that before going to bed as the prices at night are at their minimum. So in the morning I take the dish out knowing it was washed at the cheapest time using greener energy.

This is just another example of how powerful and versatile Home Assistant platform is.

If you’re considering switching to Octopus you will get £50 if you use my referral link: https://share.octopus.energy/rainy-jewel-32

I was able to cut my monthly bill from £30 to £15 just by using less energy during the peak time between 16:00 and 19:00.

Thanks for reading.

Mike.

--

--