Electric (instant+counter) - Domoticz doesn't compute Energy

Moderator: leecollings

Post Reply
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Electric (instant+counter) - Domoticz doesn't compute Energy

Post by jake »

I'm feeding an 'Electric (instant + counter)' device only with the (generated) power.

Code: Select all

device.updateElectricity(power in watts)
I would like Domoticz to do the calculation of energy. Although showing/tracking the power value during the day, the Energy counter stays 0, day after day.

I know it can work, because my micro-inverters of the solar panels update themselves (power only) through a json command to the same type of virtual device and there the Domoticz computing of Energy is very reliable.

I tried it to feed the device like this:

Code: Select all

device.updateElectricity(power in watts, 0)
but this doesn't help. Or

Code: Select all

device.updateElectricity(power in watts, '')
but that gives an error.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Electric (instant+counter) - Domoticz doesn't compute Energy

Post by dannybloe »

I suspect this is a Domoticz problem. I'm only setting the commandArray and send that back to Domoticz.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Electric (instant+counter) - Domoticz doesn't compute Energy

Post by jake »

dannybloe wrote: Friday 09 February 2018 17:28 I suspect this is a Domoticz problem. I'm only setting the commandArray and send that back to Domoticz.
In this topic a possible solution was given to let the electrical device compute energy properly, by feeding the device through json.

To test this I used 2 virtual 'Electrical (counter + incremental)' sensors. The 1st one is fed by this dzVents command:

Code: Select all

local currentpower = (inv1.WhActual + inv2.WhActual + inv3.WhActual + inv4.WhActual + inv5.WhActual)
totSolar.updateElectricity (currentpower,0) 
The 2nd one is fed by this json command in dzVents:

Code: Select all

local solarUrl = 'http://127.0.0.1:8080/json.htm?type=command&param=udevice&idx=295&nvalue=0&svalue='..currentpower..';0'
		domoticz.openURL({
			url = solarUrl,
			method = 'GET'
			})
the 2nd sensor is being updated by the json command and after sometime it starts to count/compute energy as well.

2 days later I started updating the 1st sensor as well with the json command: within a short time the device started to compute energy.

Summarizing: something is going on with the LUA code to update the electrical device, while through json it works as expected.
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Electric (instant+counter) - Domoticz doesn't compute Energy

Post by McMelloW »

dannybloe wrote: Friday 09 February 2018 17:28 I suspect this is a Domoticz problem. I'm only setting the commandArray and send that back to Domoticz.
If this is a Domoticz problem, who can we contact to look at it? There are several topics about it and an issue #2196 is openeded. But nothing so far.
Greetings McMelloW
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Electric (instant+counter) - Domoticz doesn't compute Energy

Post by jake »

The 1st sensor 'computed' energy for 2 days. Both days had exactly the same 'Energy' harvest. Ths is incorrect. On day 3 the sensor didn't compute anymore.
The 2nd sensor keeps computing correctly.

Something is completely screwed with counters. I have the same kind of problems with counting in m3 gas. I simply can't get my finger behind it, but values are not correct.
mraichura
Posts: 13
Joined: Friday 16 December 2016 4:59
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Rajkot, IN
Contact:

Re: Electric (instant+counter) - Domoticz doesn't compute Energy

Post by mraichura »

Hello All,

I'm receiving total current load via MySensors and voltage from a Sonoff POW. I then created a dummy sensor as follows

Code: Select all

Idx: 46
Sensor Type: Electric (Instant + Counter)
Type: Usage
Energy Read: Computed
The power wattage is calculated in Node-Red and sent to Idx: 46 via MQTT. The payload is as follows.

Code: Select all

{
    "idx": 46,
    "nvalue": 0,
    "svalue": "5191;0.000"
}
It was working fine from June 6 until a couple of hours ago. Now, the sensor value in Watts is visible but computed Energy usage (Total & Today) show nan.
Domoticz.png
Domoticz.png (15.3 KiB) Viewed 5092 times
Any help?
1 x RASPBERRY PI 1 MODEL B+ running Domoticz since June 2016
1 x RASPBERRY PI 3 MODEL B running Domtoicz since August 2017
gajotnt
Posts: 70
Joined: Monday 06 February 2017 12:48
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.9700
Location: Azores
Contact:

Re: Electric (instant+counter) - Domoticz doesn't compute Energy

Post by gajotnt »

Hello, is there any news on this?

I also have a dummy that doesnt compute the energy usage right. Using a lua script to update the counter.

Dont know how to use the comands posted above :(
buzzzy
Posts: 7
Joined: Wednesday 24 January 2018 22:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Electric (instant+counter) - Domoticz doesn't compute Energy

Post by buzzzy »

I have the same problem... I'm getting strange data/graphs with both calculated and energy from device. Power seems OK, but energy isn't correct. No warnings from the script, and there should be no reason to have zero energies appearing like this:

Image

Version: 4.10717
Attachments
2020-01-16 09_51_23-Domoticz.png
2020-01-16 09_51_23-Domoticz.png (88.22 KiB) Viewed 3112 times
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Electric (instant+counter) - Domoticz doesn't compute Energy

Post by FireWizard »

Hi,

You wrote:
I have the same problem
You have the same problem as what?

In this topic, which started almost two years ago and the last post has been approx 1.5 years ago, various issues are described.
Some of them indicate an issue with a script (lua and/or dzvents), while another one indicate a problem received from Node Red.
(NaN is typical Java and indicates Not a Number)

Since September 2018 a lot of changes has been made and probably some of the issues, mentioned above, are already solved.

Can you describe your problem in more detail?

Regards
zaphod
Posts: 3
Joined: Thursday 05 December 2019 18:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11551
Contact:

Re: Electric (instant+counter) - Domoticz doesn't compute Energy

Post by zaphod »

Hi,
I also have a similar issue :
- MySensor gateway attached through local USB, successfully sending V_WATT & V_KWH every minute, freshly updated as shown here :
Selection_214.jpg
Selection_214.jpg (16.19 KiB) Viewed 3086 times
- Energy values are set "from device" rather than "computed"
- but yesterday, after a domoticz OTA software update, the energy consumption (Watt.h) histogram has gone flat :
utilisation-dernire-7-jo.png
utilisation-dernire-7-jo.png (99.39 KiB) Viewed 3086 times
- the DB shows that the both Watt and Watt.h actual values are correctly recorded in the corresponding table:

Code: Select all

sqlite> select * from Meter  where DeviceRowID=76 order by date desc limit 10;
DeviceRowID|Value|Usage|Date
76|15236|5911|2020-01-18 00:05:00
76|15184|7033|2020-01-18 00:00:00
76|15134|5618|2020-01-17 23:55:00
76|15087|5570|2020-01-17 23:50:00
76|15040|5356|2020-01-17 23:45:08
76|14992|5379|2020-01-17 23:40:00
76|14946|5323|2020-01-17 23:35:00
76|14902|5445|2020-01-17 23:30:01
76|14859|4503|2020-01-17 23:25:01
76|14815|4499|2020-01-17 23:20:02
- however at the time of the update, it appears the Watt.h value was reset:

Code: Select all

sqlite> select * from Meter  where DeviceRowID=76 order by date desc limit 20 offset 410;
DeviceRowID|Value|Usage|Date
76|452|5120|2020-01-16 14:00:00
76|409|5142|2020-01-16 13:55:00
76|367|5133|2020-01-16 13:50:00
76|324|5131|2020-01-16 13:45:00
76|278|5044|2020-01-16 13:40:00
76|236|5042|2020-01-16 13:35:00
76|194|4992|2020-01-16 13:30:00
76|152|4968|2020-01-16 13:25:00
76|107|4925|2020-01-16 13:20:00
76|66|4933|2020-01-16 13:15:00
76|25|4935|2020-01-16 13:10:01
76|157169|4921|2020-01-16 13:05:00
76|157124|5177|2020-01-16 13:00:00
76|157083|4902|2020-01-16 12:55:00
76|157044|4628|2020-01-16 12:50:00
76|157004|5028|2020-01-16 12:45:00
76|156959|6060|2020-01-16 12:40:09
76|156918|4532|2020-01-16 12:35:00
76|156880|4512|2020-01-16 12:30:00
76|156843|4522|2020-01-16 12:25:00
- Even if the Watt.h is reset, it seems there should still be Watt.h values registered every hour in the histogram?
- However the daily sums over a week are correct for today (the sum was wrong on the day of the update and showed 157 kW.h, ie the recorded value before the drop, so I mended manually in the Meter_Calendar table) :
sur-la-semaine-passe.png
sur-la-semaine-passe.png (72.85 KiB) Viewed 3086 times
- this has happened once before, after a domoticz reboot if I remember correctly.
- Current domoticz version:
Version: 4.11605
Build Hash: 7de1f368f
Compile Date: 2020-01-08 23:12:15
dzVents Version: 2.5.5
Python Version: 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516]
Uptime: 1 Jours, 11 Heures, 6 Minutes, 10 Secondes

Any help much appreciated, as reboots/updating are likely to occur regularly, and this hourly histogram is very useful for tracking energy eating appliances...
Many thanks !
Gruzi
Posts: 5
Joined: Friday 28 February 2020 9:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Electric (instant+counter) - Domoticz doesn't compute Energy

Post by Gruzi »

Hi all,

Did someone manage to solve this issue?
I have something similar.

The values delivered by the solar panels are ok. Values are Power and Energy, part of log:
Date Time - Power - Energy
2020-03-31 10:47:03.774 Status: LUA: data= 2621;2500.0
2020-03-31 10:51:05.608 Status: LUA: data= 2727;2700.0
2020-03-31 10:55:08.822 Status: LUA: data= 2862;2900.0
2020-03-31 10:59:03.334 Status: LUA: data= 2951;3100.0
2020-03-31 11:03:05.096 Status: LUA: data= 3204;3300.0
2020-03-31 11:07:03.690 Status: LUA: data= 3430;3500.0
2020-03-31 11:11:03.834 Status: LUA: data= 3606;3800.0
2020-03-31 11:15:05.495 Status: LUA: data= 3835;4000.0

The graphing of the Power is ok, yellow line.
The graphing of the Energy is 0 until 14.00, blue line.

Why is the Energy graph 0 until 14.00 and from 14.00 displayed?
Attachments
generated-last-24-hours (1).jpeg
generated-last-24-hours (1).jpeg (46.86 KiB) Viewed 2767 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests