Problems with energy sensor in Energy Dashboard

Hello,
I am trying to get my energy usage integrated into the Energy Dashboard and having issues with my main sensor. I use Florida Power & Light (FPL) and use a custom integration that gets various data from the FPL API. This all works well and while I don’t get hourly usage data, I do get a daily value that is updated every day around 4 or 5am in the morning.

This is sensor.fpl.dailyusagekwh. The problem I am having is that this value resets each day early morning to the previous day’s value but the energy dashboard seems to be treating it as if it should be increasing each day. So for example if today my daily value is less than yesterday, the dashboard will actually say I used negative energy.

I’m wondering if the problem is that the sensor doesn’t reset at midnight and Dashboard has already done it’s daily reset or something?

The sensor is marked as total_increasing but also does have a correctly set last_reset time so it seems like it should work?

attribution: This data is provided by FPL.
integration: FPL
friendly_name: Daily Usage
device_class: energy
state_class: total_increasing
unit_of_measurement: kWh
date: 2022-07-22T00:00:00.000-04:00
last_reset: 2022-07-21T00:00:00.000-04:00
icon: mdi:flash

Hmm no one has any ideas? I"m really thinking it is getting confused because the reset time is in the morning. Not sure how to fix this though.

Hi jwvanderbeck,

As I understand it, “Total_Increasing” is used for sensors that are always going up (such as those probably used by your utility company in your fusebox). So I think it is behaving as it should when you state: "The problem I am having is that this value resets each day early morning to the previous day’s value but the energy dashboard seems to be treating it as if it should be increasing each day. "

(Basically with “total_increasing” it will view “last_reset” as the 0 value and then the next update will be how much it changed from that 0 value. This way you can for example measure how much energy you have used since “last_reset” for a sensor value that is always increasing.)

Based on the documentation I could find Source, I think you are in this situation: “The sensor’s state is reset with every state update, for example a sensor updating every minute with the energy consumption during the past minute: state class ‘total’, ‘last_reset’ updated every state change.”
(In your case updating every day instead of minute.)

Again, not an expert but I believe you should be using “total” not “total_increasing”. You should be using “measurement” as both “total” and “total_increasing” are for sensors that don’t reset from 0. If you don’t want to mess up historical data, maybe wait for someone with more experience to confirm (or correct) what I am saying, but otherwise you could try changing to “measurement” and see how it behaves.

The one thing I am not sure about is that the documentation also states the state is updated every 5minutes, which would lead to silly statistics if it thinks your “daily” use happens every 5minutes haha. I think this can be mitigated by ensuring that the “last_reset” is only changed once per day to avoid getting such erroneous results but I seem to recall that I got errors that “last_reset” wasn’t available for “measure”, but you could give it a try.

Hope this helps :slight_smile:

Edit: Corrected wrong advise.