BottlecapDave / HomeAssistant-OctopusEnergy

Unofficial Home Assistant integration for interacting with Octopus Energy
https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/
MIT License
583 stars 60 forks source link

Agile Peak Rates/Threshold #700

Closed rd778 closed 9 months ago

rd778 commented 9 months ago

Describe the feature

On the Agile tariff, the most expensive rates vary by day. Typically they're around 4:00-6:30pm, but not always.

It would be really helpful to have a sensor to know when the most expensive times are during the day (either an on/off binary sensor or start/end time). This will let me automatically turn on/off devices.

I imagine the sensor would be triggered when the electricity prices are either above a manually configured threshold or simply over the average+standard deviation.

Why not use the existing target sensor? Because the duration of the peak period varies. Most often it is between 4:00-6:30pm. However, on other days it is just an hour long. The target sensors have a fixed duration, so can't lengthen or shorten automatically.

Perhaps this already exists. However, I've looked at the existing "off peak" sensor and (on my setup at least) it is constantly set to "off" 24/7.

Thanks!

Expected behaviour

Either:

Use Case

Automatically turn off devices during the most expensive times of the day. Since the peak times can vary in duration, the existing target sensor isn't able to do this (as that has a fixed duration).

Confirmation

BottlecapDave commented 9 months ago

Hello.

When the off peak sensor was introduced, it was specifically built to target the lowest rate specified for the day for tariff that have 2 or 3 unique rates during the day (I'll update the FAQ on this). This is driven from the rate data as there's nothing in the API that states "off peak".

Agile tariffs were specifically missed off because as the tariff is agile everyone will have their own thresholds about what they would classify as "off peak"

  1. Is it the lowest rate, which could appear once or multiple sporadic times during the day? If so, this could be very high on very bad days for which someone might not want their house doing stuff at high rates. What happens if the next lowest rate is 1p more? To some people this would be off peak too, and to other it wouldn't
  2. Is it a rate that is below zero? The rules are more abiguous, which is why target rate sensors are suggested for people on an Agile tariff.

For these applicable tariffs, a "peak" sensor wasn't needed as it was usually just the when the off peak sensor was off. For Agile, again a peak sensor didn't make much sense as everyone has different criteria for what peak means.

  1. Is it when the rate reaches 100p which is the current top?
  2. Is it the highest rate, which could appear once or multiple sporadic times during the day? What happens if the highest rate is 60p and the next lowest rate is 59p? Is this not peak?

    Octopus state there peak period is between 4:30pm and 7pm, but this just adds a multiplier to their calculations because it's the busiest period. However there's nothing stopping it from being cheaper than other parts of the day (for example it could be incredibly windy and sunny during that period but then fully gas driven at another part of the day).

This is why I provide as much data as possible, which can then be configured by people to their needs.

I imagine the sensor would be triggered when the electricity prices are either above a manually configured threshold

This is possible today by looking at the current rate state and checking if it's above or below an amount

{{ states('sensor.current_rate') > 0.30 }}

I imagine the sensor would be triggered when ... simply over the average+standard deviation.

This is possible today by looking at the average rate attribute on the current rate sensor

{{ state_attr('sensor.current_rate', 'current_day_average_rate') | round(2) > states('sensor.current_rate'') | round(2) }}

Because of this, off peak/peak sensor support is not currently on the cards for Agile tariff.