Page 1 of 1

Calculated energy consumption off?

Posted: Wednesday 28 April 2021 13:35
by olleman
Hello!

I have a power meter on my boat and meassure charge and discharge in two different uility devices. This is how the graph for discharge looks right now.
energy.JPG
energy.JPG (42.39 KiB) Viewed 1497 times
The maximum consumption is 280w and minimum 220w. So how can domoticz calculate it to be 354Wh per hour?
I use the input data to feed an electric counter in domoticz as well and this counter gets it right with about 240wh per hour.
energy counter.JPG
energy counter.JPG (46.67 KiB) Viewed 1497 times
Any ideas?

Re: Calculated energy consumption off?

Posted: Wednesday 28 April 2021 17:01
by waltervl
How do you measure the power usage (220-280Watt)? Script or plugin or http json updates? What data is send to Domoticz? What type and subtype of Energy device is used (from setup - device list)?

Re: Calculated energy consumption off?

Posted: Wednesday 28 April 2021 21:00
by olleman
Thanks for answering!

I meassure with an INA219 sensor and wemos d1 mini running espeasy. Using rules in espeasy I update the power measured every 10 seconds.
The counter that I use as a control uses the exact same data and is being updated via a script in domotics every time the energy meter gets an update.

The energy meter is an electric (instant + counter) with subtype "usage".

Look at my first graph, doesn't it look peculiar just by looking at it? All power readings are between 220-280. It's not possible to get more than 280wh per hour but still it's being calculated to more than 300wh.

Re: Calculated energy consumption off?

Posted: Wednesday 28 April 2021 21:42
by waaren
olleman wrote: Wednesday 28 April 2021 21:00 Look at my first graph, doesn't it look peculiar just by looking at it? All power readings are between 220-280. It's not possible to get more than 280wh per hour but still it's being calculated to more than 300wh.
What do you see when you enter below http calls from your browser address bar?

Code: Select all

http://<>domoticz ip:domoticz port>/json.htm?type=graph&sensor=counter&range=day&method=1&idx=<idx>
http://<>domoticz ip:domoticz port>/json.htm?type=devices&rid=<idx>

Re: Calculated energy consumption off?

Posted: Wednesday 28 April 2021 22:59
by waltervl
And when you edit the device can you switch Energy Read between from device and computed? And what is it's setting now?

Re: Calculated energy consumption off?

Posted: Thursday 29 April 2021 8:16
by olleman
waaren wrote: Wednesday 28 April 2021 21:42
olleman wrote: Wednesday 28 April 2021 21:00 Look at my first graph, doesn't it look peculiar just by looking at it? All power readings are between 220-280. It's not possible to get more than 280wh per hour but still it's being calculated to more than 300wh.
What do you see when you enter below http calls from your browser address bar?

Code: Select all

http://<>domoticz ip:domoticz port>/json.htm?type=graph&sensor=counter&range=day&method=1&idx=<idx>
http://<>domoticz ip:domoticz port>/json.htm?type=devices&rid=<idx>
The output for the first one consists of a lot of "220" values and a few "280" and of course the sums of every hour at about ~340wh per hour.

The second one gives me this output:

Code: Select all

{
	"ActTime" : 1619688711,
	"AstrTwilightEnd" : "00:00",
	"AstrTwilightStart" : "00:00",
	"CivTwilightEnd" : "21:46",
	"CivTwilightStart" : "04:29",
	"DayLength" : "15:38",
	"NautTwilightEnd" : "22:57",
	"NautTwilightStart" : "03:18",
	"ServerTime" : "2021-04-29 11:31:51",
	"SunAtSouth" : "13:08",
	"Sunrise" : "05:18",
	"Sunset" : "20:57",
	"app_version" : "2021.1",
	"result" : 
	[
		{
			"AddjMulti" : 1.0,
			"AddjMulti2" : 1.0,
			"AddjValue" : 0.0,
			"AddjValue2" : 0.0,
			"BatteryLevel" : 255,
			"CustomImage" : 0,
			"Data" : "0, 220.00",
			"Description" : "",
			"EnergyMeterMode" : "1",
			"Favorite" : 1,
			"HardwareDisabled" : false,
			"HardwareID" : 2,
			"HardwareName" : "Rpi3",
			"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
			"HardwareTypeVal" : 15,
			"ID" : "00082013",
			"LastUpdate" : "2021-04-29 11:31:51",
			"Name" : "Batterif\u00f6rbrukning",
			"Notifications" : "false",
			"PlanID" : "0",
			"PlanIDs" : 
			[
				0
			],
			"Protected" : false,
			"ShowNotifications" : true,
			"SignalLevel" : "-",
			"SubType" : "kWh",
			"SwitchTypeVal" : 0,
			"Timers" : "false",
			"Type" : "General",
			"TypeImg" : "current",
			"Unit" : 1,
			"Used" : 1,
			"XOffset" : "0",
			"YOffset" : "0",
			"idx" : "13"
		}
	],
	"status" : "OK",
	"title" : "Devices"
}
}

Re: Calculated energy consumption off?

Posted: Thursday 29 April 2021 8:21
by olleman
waltervl wrote: Wednesday 28 April 2021 22:59 And when you edit the device can you switch Energy Read between from device and computed? And what is it's setting now?
It's set at "computed now" since my device only send the current power usage 6 times each minute.

I tried setting it to "device". The log stays the same but I'm not getting any numbers at all from the device now. Even after I changed it back to "computed" the device still doesn't show any reading!? Any idea how to get it back :)?
power2.png
power2.png (26.42 KiB) Viewed 1451 times

Re: Calculated energy consumption off?

Posted: Thursday 29 April 2021 11:39
by olleman
Here's the complete output with the data from the sensor.

Re: Calculated energy consumption off?

Posted: Thursday 29 April 2021 16:14
by waltervl
olleman wrote: Thursday 29 April 2021 8:21 It's set at "computed now" since my device only send the current power usage 6 times each minute.
I tried setting it to "device". The log stays the same but I'm not getting any numbers at all from the device now. Even after I changed it back to "computed" the device still doesn't show any reading!? Any idea how to get it back :)?
Oops, I did not want to break something. "Computed" seemed to be the right setting in your case. Device is only needed when the device is sending the usage on its own. Seems indeed that in your case the compute function is not computing right.
Do you see any reading in device list? Perhaps CtrL-F5 on the page with the empty device widget?
Anything in the log file for this device?

Re: Calculated energy consumption off?

Posted: Friday 30 April 2021 7:21
by olleman
waltervl wrote: Thursday 29 April 2021 16:14
olleman wrote: Thursday 29 April 2021 8:21 It's set at "computed now" since my device only send the current power usage 6 times each minute.
I tried setting it to "device". The log stays the same but I'm not getting any numbers at all from the device now. Even after I changed it back to "computed" the device still doesn't show any reading!? Any idea how to get it back :)?
Oops, I did not want to break something. "Computed" seemed to be the right setting in your case. Device is only needed when the device is sending the usage on its own. Seems indeed that in your case the compute function is not computing right.
Do you see any reading in device list? Perhaps CtrL-F5 on the page with the empty device widget?
Anything in the log file for this device?
Refresh with CTRL-F5 or even trying in incognito mode doesn't solve the problem. Under devices it seems "stuck" it's showing new updates with new values all the time but the value is always "280" which can't be right. almost 9/10 readings are 220 so something happened here...perhaps the database got corrupt for this particular device? It's not the end of the world, I can always make a new device but it's always nice to find the solution :)

So now I've got two problems it seems :)

Re: Calculated energy consumption off?

Posted: Friday 30 April 2021 16:36
by olleman
hm...problem solved.

I had to recreate the sensor to get rid of the problem with it not updating at all. And guess what!? It now calculates correctly. Not only that, recreating another sensor I have for total battery consumption now allows for negative values. I guess I created these sensors a couple of years ago and things have changed since then, but only for newly created sensors!

Re: Calculated energy consumption off?

Posted: Friday 30 April 2021 18:29
by waltervl
Ok, well glad it was solved..
you know there is a replace function so you can copy the history data if the old in the new device if needed?

Re: Calculated energy consumption off?

Posted: Friday 30 April 2021 20:06
by olleman
waltervl wrote: Friday 30 April 2021 18:29 Ok, well glad it was solved..
you know there is a replace function so you can copy the history data if the old in the new device if needed?
Yes, but the problem persisted when I used that function so I used brand new ones.