#2 similar energy sensors in the energy dashboard, one always showing zero

1 messages · Page 1 of 1 (latest)

waxen light
#

I collect data from a solar diverter over a serial port and pre-process and send it to HA via MQTT using Python. So, I have full control over topics, attributes, etc.
I have configured the energy dashboard to use some of the sensors. In particular I have added the solar and grid energy used to heat the hot water to “Individual Devices”. Although both sensors are identical in terms of attributes etc., “Hot Water (Grid)” always shows zero.

These are the 2 sensors

    Sensor 1
    sensor.paladin_lm_total_hwc_diverted_energy
    Display Name
    Hot Water (Solar)
    Attributes (from states tab in Developer Tools)
    state_class: total_increasing
    unit_of_measurement: kWh
    device_class: energy
    friendly_name: Paladin LM Total HWC Diverted Energy

MQTT Paladin LM debug info for sensor 15 is attached

and

    Sensor 2
    sensor.paladin_lm_total_hwc_top_up_energy
    Display Name
    Hot Water (Grid)
    Attributes (from states tab in Developer Tools)
    state_class: total_increasing
    unit_of_measurement: kWh
    device_class: energy
    friendly_name: Paladin LM Total HWC Top Up Energy

MQTT Paladin LM debug info for sensor 16 is attached

“Hot Water (Solar)” (sensor.paladin_lm_total_hwc_diverted_energy) is shown just fine but “Hot Water (Grid)” (sensor.paladin_lm_total_hwc_top_up_energy) shows 0 kWh.

The history shows that both sensor have values different from 0.

Note: All total energy sensors (from the diverter) reset in the night back to 0. But this is handled correctly by the HA energy dashboard and all other sensors show just fine.
I even have turned the problematic sensor into an always increasing one in Python (detecting the reset and keep increasing the energy) but the problem persists. Further I swapped the dataof both sensors in Python but “Hot Water (Grid)” which now carries the data from “Hot Water (Solar)” still shows 0.

What can I do to get this working?

dreamy nexus
#

Check Dev tools -> statistics if you have any repairs for that sensor

waxen light
#

No, there no FIX ISSUE tag on it. Also no warning in the energy dashboard configuration.

brisk perch
#

Can you grab and share the download CSV from energy page?

waxen light
brisk perch
#

For both paladin sensors, what's the statistics unit in developer tools/statistics, Wh or kWh?

#

I see they're coming in as Wh, but you've got them converted to kWh?

#

Maybe grab the CSV from that history page too

#

Put it on a code-share site if it's too big for discord.

waxen light
#

What I have shared above is what the developer tools states page show. Both sensors are shown as "unit_of_measurement: kWh" but in the discovery messages I've sent via MQTT they are both in Wh. HA converts that automatically.

brisk perch
#

statistics unit is slightly different than unit of measurement, but I guess that's probably not the issue.

waxen light
#

By now it is only hourly data points because it is longer than a week ago. So it is not that big. See attached.

brisk perch
#

Hmm, well this one is a puzzler 🤔

waxen light
#

Yeah, I know. I try to figure it out since weeks. As I said I swapped the data of the 2 sensors and it was the same sensor which showed zero. So it is not the data itself. I'm running out of ideas what to try.

brisk perch
#

Looked through logs?

#

How about a statistics graph card, does it show permanent 0 for this sensor?

waxen light
#

I'll check both.

brisk perch
#

And I guess you didn't do anything weird with customize: ?

waxen light
#

Here are 2 screenshots from a statistics card. On the 11th the top up energy shows all zero.

brisk perch
#

but it's working on other days?

#

It's weird that state has a value but sum is 0.

waxen light
#

No it is never working. The Top Up Energy sensor shows always 0 in the energy dashboard.

brisk perch
#

energy uses the sum value

#

something wrong in the statistics for that sensor but I'm not sure what.

#

sum should be always increasing

#

Can you just nuke the sensor and make a new one with a different name, see if that helps?

waxen light
#

But it is not the data itself. When I swap it it is shown OK in the Diverted energy sensor.

brisk perch
#

Neverless, that top up energy sensor is not recording the sum correctly. I'm not sure how it happened, but you have a statistics problem.

#

Energy just uses the statistics, so I would just forget about energy until you get a sensor that has correct statistics

waxen light
#

Yeah, I can rename it do something else.

brisk perch
#

If you can't get it working, open a core issue for recorder integration and put all that detail in it.

waxen light
#

What part of HA is building the statistics?

brisk perch
#

recorder

waxen light
#

Ah OK.

#

It does that automatically without any configuration I guess?

brisk perch
#

pretty much

#

I can't say I've ever come across this particular problem before

waxen light
#

Thanks anyway. I'm a small step further. I know now that it is not the energy dashboard but something with wrong statistics by the recorder.

brisk perch
#

An easy way to get a "new" entity is maybe just make a template sensor from the value of top up energy.

#

you can observe that and see if it behaves differently.

waxen light
#

I can just delete the device, change the name in my Python code and restart the service. It will send discovery messages and HA will recreate the device with new names.