Page 1 of 1

Not showing negative value for smart energy meter

Posted: Monday 10 February 2020 13:52
by Jimster
Hi, I'm not sure if this is a bug.
Domoticz will show a negative value when my energy production is higher than my consumption, but Dashticz will show a positive value.
Image
Image

Or how can I change this so a negative value is shown?

Domoticz version 4.10717
Dashticz version 3.3.5 beta

Re: Not showing negative value for smart energy meter

Posted: Saturday 29 February 2020 13:56
by clinkadink
Do you know what "1095 watt" relates to?

Can you post the output of your device info ...

http://127.0.0.1:8880/json.htm?type=devices&rid=IDX

^^^ change IP and IDX accordingly.

Re: Not showing negative value for smart energy meter

Posted: Saturday 29 February 2020 21:06
by Jimster
-1095 watt was my energy usage at that moment, Dashticz showed 1095 while Domoticz showed -1095.
I will post the output when the sun shines :)

Re: Not showing negative value for smart energy meter

Posted: Sunday 01 March 2020 11:08
by Jimster
Here is what Dashticz and Domoticz shows:
Image

This is the output:

Code: Select all

{
   "ActTime" : 1583057176,
   "AstrTwilightEnd" : "20:13",
   "AstrTwilightStart" : "05:34",
   "CivTwilightEnd" : "18:55",
   "CivTwilightStart" : "06:52",
   "DayLength" : "10:56",
   "NautTwilightEnd" : "19:34",
   "NautTwilightStart" : "06:13",
   "ServerTime" : "2020-03-01 11:06:16",
   "SunAtSouth" : "12:54",
   "Sunrise" : "07:25",
   "Sunset" : "18:22",
   "app_version" : "4.10717",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "Counter" : "8427.982",
         "CounterDeliv" : "122.197",
         "CounterDelivToday" : "0.520 kWh",
         "CounterToday" : "1.919 kWh",
         "CustomImage" : 0,
         "Data" : "4034842;4393140;29147;93050;0;1898",
         "Description" : "",
         "Favorite" : 0,
         "HardwareID" : 7,
         "HardwareName" : "Slimme meter",
         "HardwareType" : "P1 Smart Meter USB",
         "HardwareTypeVal" : 4,
         "HaveTimeout" : false,
         "ID" : "0001",
         "LastUpdate" : "2020-03-01 11:06:16",
         "Name" : "Slimme meter",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "SubType" : "Energy",
         "SwitchTypeVal" : 0,
         "Timers" : "false",
         "Type" : "P1 Smart Meter",
         "TypeImg" : "counter",
         "Unit" : 1,
         "Usage" : "0 Watt",
         "UsageDeliv" : "1898 Watt",
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "57"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}

When Usage is 0, Dashticz shows "UsageDeliv" : "1898 Watt", as a positive value, while Domoticz shows a negative value.

Re: Not showing negative value for smart energy meter

Posted: Sunday 01 March 2020 11:21
by clinkadink
Thanks for the output of the device. That url is from Domoticz, not Dashticz.

http://127.0.0.1:8080/json.htm?type=devices&rid=IDX

It is Domoticz that is actually reporting a positive value, look at the end of this line in your Domoticz output:

Code: Select all

"Data" : "4034842;4393140;29147;93050;0;1898",
Therefore, they must apply some kind of calculation in the Domoticz tile it self. I.e. on the page. I am sorry, but I do not know how you can apply the same logic to a block in Dashticz. You can in a graph block with custom data (and a calculation) - but that doesn't help you in this case.

Maybe Lokonli will know if this is possible.

Re: Not showing negative value for smart energy meter

Posted: Sunday 01 March 2020 11:53
by Jimster
clinkadink wrote: Sunday 01 March 2020 11:21 Thanks for the output of the device. That url is from Domoticz, not Dashticz.

http://127.0.0.1:8080/json.htm?type=devices&rid=IDX

It is Domoticz that is actually reporting a positive value, look at the end of this line in your Domoticz output:

Code: Select all

"Data" : "4034842;4393140;29147;93050;0;1898",
Therefore, they must apply some kind of calculation in the Domoticz tile it self. I.e. on the page. I am sorry, but I do not know how you can apply the same logic to a block in Dashticz. You can in a graph block with custom data (and a calculation) - but that doesn't help you in this case.

Maybe Lokonli will know if this is possible.
Not sure what you mean with "That url is from Domoticz, not Dashticz.".

The first zero is Energy usage, 1898 is the energy delivery at that moment.
For example, currently it is:

Code: Select all

 "Data" : "4034999;4393140;30055;93050;2208;0",
So only Usage at this moment and no delivery (you can't have both I think, one of both must be 0).
Now Domoticz shows 2208 Watt and Dashticz too.

Re: Not showing negative value for smart energy meter

Posted: Sunday 01 March 2020 12:08
by clinkadink
Understood. So there needs to be a calculation on the last two parts of data returned from your device.

Code: Select all

var data = device.Data;
var correctReading = data.split(';')[4] - data.split(';')[5];
In this case ... correctReading would be -1898.

Code: Select all

"Data" : "4034842;4393140;29147;93050;0;1898",
And in this case ... correctReading would be 2208.

Code: Select all

"Data" : "4034999;4393140;30055;93050;2208;0",
The problem is where to apply this logic :shock:

Re: Not showing negative value for smart energy meter

Posted: Monday 02 March 2020 11:50
by Lokonli
clinkadink wrote: Sunday 01 March 2020 12:08 Understood. So there needs to be a calculation on the last two parts of data returned from your device.

Code: Select all

var data = device.Data;
var correctReading = data.split(';')[4] - data.split(';')[5];
In this case ... correctReading would be -1898.

Code: Select all

"Data" : "4034842;4393140;29147;93050;0;1898",
And in this case ... correctReading would be 2208.

Code: Select all

"Data" : "4034999;4393140;30055;93050;2208;0",
The problem is where to apply this logic :shock:
We could create a customized Domoticz block for P1 devices.

I'm preparing an update for all Domoticz blocks ...
Then it also will be more easy to fine tune the way Dashticz represents the device data.

Re: Not showing negative value for smart energy meter

Posted: Wednesday 18 March 2020 22:28
by Lokonli
Will be fixed in next beta.

Re: Not showing negative value for smart energy meter

Posted: Monday 04 May 2020 15:55
by dorenberg
Is there any news on this. I am at version 3.3.3.1 master. Was is already solved in the beta?

Re: Not showing negative value for smart energy meter

Posted: Monday 04 May 2020 16:42
by dorenberg
upgraded to 3.4.5 beta. Value is now in negative but only oneout of 2 values is reported.

Re: Not showing negative value for smart energy meter

Posted: Monday 04 May 2020 23:20
by Lokonli
I do not completely understand you. Which 2 values do you mean? What should change?

Re: Not showing negative value for smart energy meter

Posted: Tuesday 05 May 2020 18:44
by dorenberg
I have a 3-phase setting in house. So it is possible that on phase 1 the return is measured, but on the other phase usage is reported. See this thread. Maybe the question is raised double. Sorry for that.

https://www.domoticz.com/forum/viewtopi ... 65#p246365

Json output of my P1 meter

{
"ActTime" : 1588697479,
"AstrTwilightEnd" : "23:47",
"AstrTwilightStart" : "03:21",
"CivTwilightEnd" : "21:48",
"CivTwilightStart" : "05:21",
"DayLength" : "15:08",
"NautTwilightEnd" : "22:40",
"NautTwilightStart" : "04:29",
"ServerTime" : "2020-05-05 18:51:19",
"SunAtSouth" : "13:34",
"Sunrise" : "06:00",
"Sunset" : "21:08",
"app_version" : "4.10982",
"result" : [
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"Counter" : "2908.815",
"CounterDeliv" : "1520.508",
"CounterDelivToday" : "10.523 kWh",
"CounterToday" : "5.049 kWh",
"CustomImage" : 0,
"Data" : "1738783;1170032;444008;1076500;248;124",
"Description" : "",
"Favorite" : 1,
"HardwareID" : 11,
"HardwareName" : "P1 kabel",
"HardwareType" : "P1 Smart Meter USB",
"HardwareTypeVal" : 4,
"HaveTimeout" : false,
"ID" : "0001",
"LastUpdate" : "2020-05-05 18:51:18",
"Name" : "P1 meter",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" : [ 0 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "Energy",
"SwitchTypeVal" : 0,
"Timers" : "false",
"Type" : "P1 Smart Meter",
"TypeImg" : "counter",
"Unit" : 1,
"Usage" : "248 Watt",
"UsageDeliv" : "124 Watt",
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "62"
}
],
"status" : "OK",
"title" : "Devices"
}

This means that 248 watt is used and at the same time 124 watt is delivered back. (because of the 3=phase approach)