Adding an Octopus Go Pricing Entity to Home Assistant

Adding an Octopus Go Pricing Entity to Home Assistant

With the recent new Energy management feature being added to HASSIO I've started work on building some DIY sensors to use.

One of the features is for you to be able to track the cost of the energy used by providing a pricing entity, back when I was on Agile I did find a plugin for tracking that cost. But recently I was unable to find one for Octopus Go.

I then figured out a simple cheat way to do this.

Automations!

Compared to agile where we need to track a price from an API, we can mostly cheat with Octopus Go / Go Faster.

I'm still on the "Legacy" Go so at 12:30AM the electric drops to £0.05 per kWh and at 4:30AM it goes back up to £0.141 per kWh. Essentially to make it match your Go or Go Faster Tarrif you just change the start and end times below.

Step 1 - Create a "Helper"

Home Assistant allows you to create "Helper" sensors / inputs, these can then be used with automations to provide extra values. Excellent!

To do this go into Configuration, and then Helpers and then the Add Helper Button.

For the type select Number, which will present you with a screen like below. I've pre-filled it out with what I've set.

This will create a new "Helper" which is configured for pricing in GBP per kWH for Hassio. Essentially as a blank sensor.

This should then create the entity input_number.octopus_go

Step 2 - The "Start" automation.

Next we need to create the automation that will start the pricing, I've decided to do the Start as the Start of the cheap period.

Go back to Configuration, then Automations and then Add Automation.

Here click Start with an empty automation, then in the top right click the three dots icon clicking the Edit in YAML button.

Now you can copy the below in as a starter template.

alias: Octopus Go Start
description: ''
trigger:
  - platform: time
    at: '00:30:00'
condition: []
action:
  - service: input_number.set_value
    target:
      entity_id: input_number.octopus_go
    data:
      value: 0.05
mode: single

And then save!

This automation is fairly simple, and you can adjust it as required with the "at" time being your Octopus Go start time. You may need to set this to another start time of the cheap period if you're on the Go Faster plan. At the same time you may need to adjust the value if you're on a Go Faster plan to your unit rate.

Step 3 - The "End" automation.

And then we need to replicate the same for the end of the cheap period, similarly go back to automations and create a new empty automation, then in the top right click the three dots icon clicking the Edit in YAML button.

Now you can copy the below in as a starter template.

alias: Octopus Go End
description: ''
trigger:
  - platform: time
    at: '04:30:00'
condition: []
action:
  - service: input_number.set_value
    target:
      entity_id: input_number.octopus_go
    data:
      value: 0.141
mode: single

And then save!

Similarly you may need to adjust the time for a different end time if you're on Go Faster, and the value to the actual unit rate you're paying.

You can find the times along with the prices in your Octopus Account.

Step 4 - Test it!

I'd recommend you then go back into automations and manually run each one to confirm that they are configured correctly. You should then see the price on the entity (I've configured Lovelace to show the price as an entity).

As you can see where I manually set the times. Over time this should then get automated by the Automations.

Step 5 - Integration

Finally you can then integrate it with your energy source, if you go into configuration then energy. You should be able to edit a power source to set the costs to "use an entity with current price" and set the octopus_go sensor we created.

Summary

So if all the above worked correctly you should now have an entity in Hassio that provides your Octopus Go cost to then integrate into power consumptions throughout HASSIO.

I'm still testing mine so if I find over the next week any issues I'll update this post with fixes.

Mastodon