Different sensor values in device and widget

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
EskildP
Posts: 7
Joined: Monday 29 January 2024 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: NO
Contact:

Different sensor values in device and widget

Post by EskildP »

The actual sensor is a power probe, reporting power consumption in my home. I use home assistant autodiscovery in Domoticz to get the sensors into Domoticz. The problem is with the Utility widget showing a different value from that in the device view (se pictures).


Can anyone explain what is going on, and adwise me to get the device value into the widget?

My Domoticz is running in a docker on a Raspberry Pi.
Attachments
2024-01-29_180637.jpg
2024-01-29_180637.jpg (68.17 KiB) Viewed 444 times
2024-01-29_180535.jpg
2024-01-29_180535.jpg (56.91 KiB) Viewed 444 times
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Different sensor values in device and widget

Post by waltervl »

What you see in the device list is the total kWh generated or produced while this device is being monitored.
Check to log or report page of that device to see more information.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
FlyingDomotic
Posts: 303
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Different sensor values in device and widget

Post by FlyingDomotic »

To give more details, data stored into kwh meters has the following format:
USAGE1;USAGE2;RETURN1;RETURN2;CONS;PROD, with:
  • USAGE1= total energy usage meter tariff 1 in Wh.
  • USAGE2= total energy usage meter tariff 2 in Wh.
  • RETURN1= total energy return meter tariff 1 in Wh.
  • RETURN2= total energy return meter tariff 2 in Wh.
  • CONS= actual usage power (Watt)
  • PROD= actual return power (Watt)
Doc specifies that:
USAGE and RETURN are total counters (they should only count up).
For USAGE and RETURN supply the data in total Wh with no decimal point.
(So if your meter displays f.i. USAGE1= 523,66 KWh you need to send 523660)
Domoticz will calculate the today values based on the delta's in the total cumulative energy of today.

You can get the full set of values going to "Setup" > "More options" > "Events". then click on the top/left icon, over the script content (should represent 3 sliders, and show "devices current states" when putting cursor over it). You''l see all devices you have, and the "Values" in last column. For this kWh device, you'll see "0/USAGE1;USAGE2;RETURN1;RETURN2;CONS;PROD". Getting these at regular interval could help debugging, if some thing is/goes wrong.

What you see in Hardware tab is probably total of (usage - return, here 0.400 kWh)

In addition to that, Domoticz computes some daily values, saving midnight's values and making difference with current ones.

What you see in widget is probably instantaneous (CONS - PROD, here 4776 Watt) and daily (usage - return, here -3.970 kWh)

The negative part (-3.970 kWh) could mean 2 things: you do produce energy (with solar panel for example, and have produced more than drain from grid), or USAGE and/or RETURN values are not correct (as this is the sum of what meter has seen since it's installed).
EskildP
Posts: 7
Joined: Monday 29 January 2024 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: NO
Contact:

Re: Different sensor values in device and widget

Post by EskildP »

Thanks for giving all these details.
In the value field for in the events view I can only see two values (picture)

Maybe the home assistant auto discovery is not the best thing to do here. Seems to be some mismatch between the received mqtt and what Domoticz is expecting.
Attachments
2024-01-30_113044.jpg
2024-01-30_113044.jpg (39.61 KiB) Viewed 394 times
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Different sensor values in device and widget

Post by waltervl »

For a General kWh device you are using has two values so this seems correct.
POWER = current power (W)
ENERGY = Integer, total cumulative energy in Watt-hours (Wh)
https://www.domoticz.com/wiki/Domoticz_ ... counter.29

FlyingDomoticz is referring to a P1 smart meter Device that has indeed more values, but you are not using that.

Did you create the MQTT AD yourself or is it connected to Zigbee2MQTT or Zwave-JS-UI?
As for both it should work.

But I do not understand what your problem exactly is? Is the device widget showing the correct data or not?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
EskildP
Posts: 7
Joined: Monday 29 January 2024 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: NO
Contact:

Re: Different sensor values in device and widget

Post by EskildP »

Yes, I created home assistant auto discovery as a new hardware 'MQTT Auto Discovery Client Gateway with LAN interface'. No ZigBee or Zwave involved.

I expected the value I see in devices to be the one showing up in the widget.

My power probe publishes a ENERGY that starts at zero at every new hour. Maybe this will not work well in Domoticz.
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Different sensor values in device and widget

Post by waltervl »

EskildP wrote: Tuesday 30 January 2024 17:17
My power probe publishes a ENERGY that starts at zero at every new hour. Maybe this will not work well in Domoticz.
That is indeed not working in Domoticz, it needs a continuous updating rolling Energy value. Like your energy counter on your home.
But if you set the device to "computed" as indicated in the wiki link I earlier posted, Domoticz can calculate the Energy based on the power values. Perhaps less accurate but gives better insight.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
EskildP
Posts: 7
Joined: Monday 29 January 2024 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: NO
Contact:

Re: Different sensor values in device and widget

Post by EskildP »

I made a workaround, by choosing another mqtt option (raw) in the power probe, doing some processing in node-red, and setting up virtual devices in Domoticz.

Thanks for your help :)
FlyingDomotic
Posts: 303
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Different sensor values in device and widget

Post by FlyingDomotic »

Another solution is to have 2 counters : the original one (as you had before switching to raw) and a virtual one (to be created manually).
The original one could be kept hidden (start its name with a $), while the virtual is to be update by a script.
This script is activated by original counter change. It reads current energy, compare it with previous (saved) one, and compute difference as :
  • current - previous if current >= previous
  • current else
This difference is then added to energy stored in virtual counter (initially set to zero), and current value saved as previous.
Power can be transferred as is.
Can provide some example if needed.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest