Custom Energy Monitor for Peak / Off-Peak Electricity Rates

Hi All,

I’ve found a few bits and pieces relating to this, but I’m looking for some advice on whether I’m on the right track, or if there are any better ways of achieving what I’m trying to do…

For a bit of background: I am in the UK and have the Octopus Go smart tariff. My rates are 0.0748p per kWh between 00:30 and 04:30 and 0.3061p per kWh outside of this. I’m hoping to set up a dashboard that tracks usage costs (I assume every 30 mins is about right) throughout the day, resetting at midnight and keeping a sum of usage costs per week, month and year.

I’ve been using the Bright Hildebrand Glow app and integrated that into HA. But, I have been having a battle with Octopus, as I cannot get the off peak rate to report between 00:30 until 04:30. I’m just seeing a flat rate of 0.3061p per kWh all day and night. The team at Bright have assured me that other customers with Octopus Go are succesfully seeing their rates switch to the off peak cost during off peak times and I have been going back and forth with Octopus support for months now and getting nowhere. So…

I’m wondering if I’d be able to use what I have so far to create something custom. So far, I have an accurate and up to date consumption report and the daily standing charge via the sensors that were added with the Hildebrand Glow DCC add-on. I have also added the following template sensor for the current Octopus Go rate, thanks to a forum post from community members:

sensor:
  - platform: template
    sensors:
      octopus_go:
        friendly_name: Octopus Go Current Rate
        unit_of_measurement: GBP/kWh
        value_template: >
          {% set tariff = { "HT": 0.3061, "LT": 0.0748 } %}
          {% if ((30 <= (now().hour * 100) + now().minute <= 430)) %}
            {{ tariff.LT }}
          {% else %}
            {{ tariff.HT }}
          {% endif %}

I guess what I’m trying to do now is tie this all together into some kind of dashboard that can multiply the current consumption by the currrent rate each time the consumption is updated (and then add the standing charge on top). I’d then hope for it to reset at midnight and be able to keep a weekly/monthly/annual track of it all.

Firstly, would that be possible to do? Second, is there a better way to achieve this same thing. Perhaps with the Octopus API?

Ideally, I’d end up with a better version of the IHD that Octopus supplied - one that works with smart tariffs.

Thanks in advance…

This would also need to take into account that the total usage cost will have a separate calculation between 00:30 and 04:30… Yeah, I think I might need a more robust solution.

Sorry if this has been asked before and done to death. I haven’t done a whole lot with Home Assistant for a little while now, so possibly a bit behind on what’s new and possible.

I also have octopus go (Actually go faster). I set it up some time ago by creating an entity for the electricity price called Octopus go. I then set up two automations to update the rate.
Start of the off peak

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

end of off peak

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

This has been working well since January. when my tariff renews at the end of the week I will just update the values and times.

Another thing I have tried to do is I created a binary sensor for Peak time. I am trying to add to my automations to switch peak on and off. That is not going so well, hence stumbling across your post. The plan being then to set automations on smart plugs based on peak on/off rather than time so that they all update if the timing changes

Just for completeness on the thread I figured out the peak on/off. It’s an input boolean which needs to use a service to turn it off and on. e.g.


alias: Octopus Go Start
description: ""
trigger:
  - platform: time
    at: "20:30:00"
condition: []
action:
  - service: input_number.set_value
    target:
      entity_id: input_number.octopus_go
    data:
      value: 0.055
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.peak
mode: single

and at the start of peak again

alias: Octopus Go End
description: ""
trigger:
  - platform: time
    at: "01:30:00"
condition: []
action:
  - service: input_number.set_value
    target:
      entity_id: input_number.octopus_go
    data:
      value: 0.1559
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.peak
mode: single

now i can configure all my automations from the peak flag rather than time based

2 Likes