[DONE/SOLVED] Possibility to record small power consumption ?

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
Francis91
Posts: 5
Joined: Friday 26 August 2022 14:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

[DONE/SOLVED] Possibility to record small power consumption ?

Post by Francis91 »

Hi,

I'm measuring power with my CurrentCost clamps (one Watt measure every 6 seconds).
I'm using the Dummy hardware with "Electric (instant + counter)", and counter is computed.

With small power (even some tens of Watts), the result in counter is either false (0) or inacurate.

In SQLHelper.cpp, I see this calculation :

float energyDuringInterval = static_cast<float>(powerDuringInterval * intervalSeconds / 3600);
float energyAfterInterval = static_cast<float>(energyUpToInterval + energyDuringInterval);

(for testing purpose, we start at 0, energyUpToInterval = 0)

So, for 20W and 6s : 20*6/3600 = 0.033Wh and for 30W : 30*6/3600 = 0.050Wh

Later, we can see :

sprintf(sValueUpdate, "%s;%.1f", powerUpdate, energyAfterInterval);

Ha ! So, if energyAfterInterval < 0.050, the %.1f brings us back to 0.

The value stored in the dB should be more precise, at least %.3f to avoid such problems.
In the database, sValue is a string (100 char if I recall correctly), so it shouldn't be a problem.

I've compiled Domoticz with this only change, and it perfectly works.
small.png
small.png (48.13 KiB) Viewed 250 times
Thanks !
Last edited by Francis91 on Thursday 01 September 2022 15:35, edited 1 time in total.
Francis91
Posts: 5
Joined: Friday 26 August 2022 14:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [done] Possibility to record small power consumption ?

Post by Francis91 »

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest