BottlecapDave / HomeAssistant-OctopusEnergy

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

Indicate where data is missing and optionally repoll to download missing data when available #753

Closed jwt99412 closed 4 months ago

jwt99412 commented 4 months ago

Describe the feature

Possibly add a sensor to indicate where data is missing for a 24 hour period as this sometimes occurs where Octopus may update the import/export data up to 48 hours later. Where data are missing this could be used to repeal the data source at a later date when the data appears.

Expected behaviour

New sensor would indicate missing data if no data received in a 24 hour period. If a control to poll for missing data were available as a service, this could be done manually by the user or in an automation.

Use Case

Very occasionally my data from Octopus is posted very late and does not come through for a couple of days. Octopus only say within 24-48 hours. The issue happened again this Monday 12/2 where import data and Gas data came through very late (22:00 or so) and export data not at all. The idea would be at least to indicate to the user that the data was missing and optionally refetch.

Confirmation

BottlecapDave commented 4 months ago

Hello. Thanks for the feature request. At this time, I'm not planning on including this as it can be accomplished easily with the available entities and the timeframe might want to be different for different people which would complicate the integration.

To achieve this now, you can setup a template sensor with the following setup

{{ now() - state_attr('sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_consumption', 'last_evaluated') >= timedelta(hours=24) }}

or for gas

{{ now() - state_attr('sensor.octopus_energy_gas_{{METER_SERIAL_NUMBER}}_{{MPRN_NUMBER}}_previous_accumulative_consumption_m3', 'last_evaluated') >= timedelta(hours=24) }}

This would represent the binary sensor you're after, which you can then use as a trigger for an automation to alert you as you see fit.

There is already a sensor for back filling previous consumption/cost. This will only update the data for the external statistics (which are recommended for energy dashboard) due to importing historic data for entities within HA is unreliable.

jwt99412 commented 4 months ago

David,

Thanks for this.

I refreshed as you state above using a manually triggered automation and it updated the missing half hour data but not the once per day data. That is ok for what I wanted. Thanks for looking at it and pointing me at the workaround.

Cheers,

Bill.

On 14 Feb 2024, at 16:12, David Kendall @.***> wrote:

Hello. Thanks for the feature request. At this time, I'm not planning on including this as it can be accomplished easily with the available entities and the timeframe might want to be different for different people which would complicate the integration.

To achieve this now, you can setup a template sensor with the following setup

{{ now() - state_attr('sensor.octopus_energyelectricity{{METER_SERIALNUMBER}}{{MPAN_NUMBER}}_previous_accumulative_consumption', 'last_evaluated') >= timedelta(hours=24) }} or for gas

{{ now() - state_attr('sensor.octopus_energygas{{METER_SERIALNUMBER}}{{MPRN_NUMBER}}_previous_accumulative_consumption_m3', 'last_evaluated') >= timedelta(hours=24) }} This would represent the binary sensor you're after, which you can then use as a trigger for an automation to alert you as you see fit.

There is already a sensor for back filling previous consumption/cost https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/services/#octopus_energyrefresh_previous_consumption_data. This will only update the data for the external statistics (which are recommended for energy dashboard) due to importing historic data for entities within HA is unreliable.

— Reply to this email directly, view it on GitHub https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues/753#issuecomment-1944149520, or unsubscribe https://github.com/notifications/unsubscribe-auth/BAMP3IZ3DWSQJLAVLOBMRUDYTTO5ZAVCNFSM6AAAAABDH73UYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBUGE2DSNJSGA. You are receiving this because you authored the thread.