#Dealing with meter sensors that are unavailable at certain times

1 messages · Page 1 of 1 (latest)

celest rampart
#

Hi! I have a heat meter, measuring total kWh since installation of the meter, and I'm reading it using a custom esphome device. Unfortunately, the meter transmits its values only during working hours, so when I add its sensor to the energy dashboard, I will see huge consumption spikes for the first reading of the day. Ideally, I'd want the difference of previous value and newest value averaged over the period where no data was available.
Is this possible with the energy dashboard, or even HA in general?

native knoll
#

That would be pretty difficult to solve.

#

The only thing I could think of would be to like remove that sensor from energy entirely, and then manually create the statistics you want to insert into the database and manage them separately with a custom integration.

celest rampart
#

oh no! I'm surprised this isn't a normal use case for the energy dashboard, I'd have assumed other use cases have to gracefully handle unavailable data as well, but oh well

#

I'm completely open to writing something myself, I'm just not sure where to approach the issue. With a custom integration, can I publish states for the past?

#

I'm still a little unclear on what a statistic actually is under the hood - is it an entity? Does it provide the computed value as its state? Would I create a custom statistic or a custom sensor, or something entirely different?

native knoll
#

A custom integration can insert statistics records into the past.

#

That's different from publishing "states" for the past, which cannot be done.