#Creating History Stats of "Today" with energy summation sensor

1 messages · Page 1 of 1 (latest)

mint harbor
#

This is probably going to be very easy for someone to answer and it feels like a very beginner issue, but ive tried to make this sensor at least 20 times with history stats and utility meter and and it either returns 0 or unknown as a result.

The sensor name is sensor.energy_monitor_summation_delivered
Its one of two sensors from a zigbee smart meter LED reader that gives live KwH, and total increasing summation delivered data.

Im trying to create a sensor that will track the KwH usage of "today". Meaning from midnight to midnight. I have a "Last 24 hours" sensor that i created from statistics and that works great, but i cant get one working to only show from "00:00 to now". I tried a history stats with a start of {{ today_at('00:00') }} & end of {{ now() }}, but it just shows 0 no matter what.

I can get the exact result i want from a statistics card with this code:
type: statistic period: calendar: period: day stat_type: change entity: sensor.energy_monitor_summation_delivered name: Today's Grid Usage

But i want it as a sensor so i can style in different dashboards.

Here are the "sensor.energy_monitor_summation_delivered" attributes:
state_class: total_increasing
status: NO_ALARMS
zcl_unit_of_measurement: 0
device_type: Electric Metering
unit_of_measurement: kWh
device_class: energy
friendly_name: Energy Monitor Summation delivered

Can someone please tell me what extremely newbie thing im doing wrong?

#

Creating History Stats of "Today" with energy summation sensor

last shore
#

That's not what history_stats does.

#

It counts time, or state events, it does not sum anything.

mint harbor
#

i had a feeling i was using it wrong, im not a strong coder by any means and i figured utility meter was the correct helper, but it doesnt return any data

last shore
#

sensor.energy_monitor_summation_delivered

Is this a lifetime energy sensor, like it just keeps increasing forever?

mint harbor
#

yes

last shore
#

utility_meter should be what you want

mint harbor
#

this returns this:

last shore
#

Is the source sensor changing?

mint harbor
#

only when im using grid power

#

i have solar

#

so it often doesnt change during the daay

last shore
#

The utility meter will only change when energy monitor summation changes

mint harbor
#

but i want the sensor to pull from all existing data

last shore
#

it will only count increases since it was created

mint harbor
#

ok so realistically i just have to wait

last shore
#

yes wait

mint harbor
#

this sensor wont work for another 24 hours

#

and theres no other way to create a statistical sensor, like a stat card, that just targets "todays" data?

last shore
#

Maybe something with SQL sensor.

#

that'd be pretty advanced though

mint harbor
#

Fair enough. I guess all i wish i could do was create a "stat card" in the style of a tile

#

which as you say, ill be able to do tomorrow, when my sensor finally updates

last shore
#

I'll guess the statistic card is overdue for a redesign