BottlecapDave / HomeAssistant-OctopusEnergy

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

Average Price for Target Sensor #128

Closed dmelliott20 closed 1 year ago

dmelliott20 commented 1 year ago

Would it be possible to add an Average Price attribute to the target sensors.

Thanks

BottlecapDave commented 1 year ago

I'll add it to the list. It probably won't be a sensor but might appear as an attribute on the current rate sensor.

dmelliott20 commented 1 year ago

Might not be explaining myself very well. I mean an average price for a target period.

So if the target sensor picks 3 slots with a price of 5p 10p and 15p the average for that target sensor would be 10p

Is that what you mean?

Thanks

Sent from my iPhone

On 21 Jan 2023, at 17:36, David Kendall @.***> wrote:



I'll add it to the list. It probably won't be a sensor but might appear as an attribute on the current rate sensor.

— Reply to this email directly, view it on GitHubhttps://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues/128#issuecomment-1399295568, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADELRFO7MC5GBIGTIIASREDWTQNALANCNFSM6AAAAAAUB3Q24M. You are receiving this because you authored the thread.Message ID: @.***>

BottlecapDave commented 1 year ago

Ok, sorry I misread the issue. Added to the list.

adamwylde commented 1 year ago

FYI @dmelliott20 if you are so inclined/in the meantime, you can do something like this with a template sensor to get the average rate for a given target (in my case called 'daytime'):

  - sensor:
      - name: "ElectricityDayRateAverageCost"
        state: "{{ state_attr('binary_sensor.octopus_energy_target_daytime','target_times') | sum(attribute='value_inc_vat') / (state_attr('binary_sensor.octopus_energy_target_daytime','Hours')*2) / 100 }}"
        icon: mdi:currency-gbp
dmelliott20 commented 1 year ago

Thanks!

On 1 Feb 2023, at 07:44, adamwylde @.***> wrote:



FYI @dmelliott20https://github.com/dmelliott20 if you are so inclined/in the meantime, you can do something like this with a template sensor to get the average rate for a given target (in my case called 'daytime'):

— Reply to this email directly, view it on GitHubhttps://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues/128#issuecomment-1411597076, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADELRFNZSEW5RU2Y5XFB2F3WVIH63ANCNFSM6AAAAAAUB3Q24M. You are receiving this because you were mentioned.Message ID: @.***>

github-actions[bot] commented 1 year ago

This issue has become stale because it has been open for 30 days with no activity. If you still think it's an issue, please respond soon.

BottlecapDave commented 1 year ago

This has been partially achieved in https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/releases/tag/v6.5.0 for current/next slots. However I need to add this for the overall target.

BottlecapDave commented 1 year ago

Overall average, min and max rates are now available within https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/releases/tag/v6.6.0