Page 1 of 2

ZigBeeForDomoticZ showing wrong power values

Posted: Saturday 17 December 2022 22:02
by kaNor
Hi,

I have a Zigate WiFi running with latest ZigBeeForDomoticZ. It works pretty well with a variety of devices :)
But for some devices that measure current and power usage, the output shown in Domoticz has the wrong power of ten.

A outletplug from Develco shows 60Amps when in reality it's 6Amps.
And for a wall outlet from Elko 2kw is show as 2000kw(?!)

Is there a way to add any recalcutation of these values, divide by 10, 100, 1000 or something?
I'm familiar with python, so if someone have a clue where in the plugin this can be modified, I'll be glad ;)

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Saturday 17 December 2022 22:10
by pipiche
please could you let us know what version of the plugin your are using ?
could you also add an export.json from WebUI > Tools > Plugin devices RAW (json)

and mentioned which plugs are delivering wrong values

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Sunday 18 December 2022 14:33
by kaNor
Hi again

I'm running plugin 6.3.007-
Se attached export.zip for the raw dump.

Device SPLZB-131 from Develco Products A/S shows 60amps instead of 6amps.
Device SOCKETOUTLET2 from Schneider Electric (branded Elko) shows 100amps instead of 10amps, and 2000kw instead of 2kw.

br
Roald Nakstad

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Sunday 18 December 2022 15:36
by pipiche
I'm not sure I follow you

at the time where the export.json was made,

for the Frient Plug
Current was 0.09 A
Power was 2.0 W

for the OUTLETT2

Current was 0.58 A
Power was 5202. Watts --> Which I tend to agree is an issue

So could you kindly do the following

move to the dev branch

git checkout dev
git pull

and restart the plugin

then
- enable debugClusters
- enable debugWidget

leave it running for a while with a known Current or Power on each of those Plug. Like if you put a 9W Led or something like that we know exactly.
From the log I'll see what is going wrong.

For the Power the is normally automatically computed by the plugin based on inputs from the device. So let see if we need to hard code some stuff`

Please drop me the plugin logs ( Logs/PluginZigbee_xx.log)

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Wednesday 21 December 2022 23:03
by kaNor
Hi again

I have now changed to dev and updated to latest.
Also set up a new Namron termostat and a singelsocket Elko-outlet as new devices, and they also shows wrong.

So for all my four devices measuring current in amps, they all shows 10 times real load.
But for wattages two devices is correct, and only those from Schneider(Elko) shows 1000000 times real wattage.

Since all values for amps are incorrect it seems like a common problem, but for power it is only wrong on devices from Schneider (Elko).

I read on another forum that according zigbee standard, the devices do deliver a divisor-atribute in conjuction with each measured value. Perhaps the plugin is getting this divisor wrong?

LOG-files is uploaded here: https://drive.google.com/drive/folders/ ... sp=sharing

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Thursday 22 December 2022 8:26
by pipiche
it is using the Multiplier or Diviser from the device, which works for many devices at that time, so just need to understand.
If you can guide on all of the log which are on your share that would be great , can you explain what are they , it will help me

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Thursday 22 December 2022 18:41
by kaNor
I set max log size to 1Mb, so all files is in reality one log. And that is the output when I enabled debugClusters and debugWidget.

Search in log-file for device 'SMART-lading' shows correct consumption of 1512watt:
.
WidgetType: Power Attribute_:
2022-12-21 21:46:16,565 DEBUG : [ZiGateForwarder_16 0] ------> SignalLevel: 4 , BatteryLevel: 255
2022-12-21 21:46:16,566 DEBUG : [ZiGateForwarder_16 0] ------> : 1512
2022-12-21 21:46:16,566 DEBUG : [ZiGateForwarder_16 0] UpdateDevice_v2 1512.0:1512: 255: 4:False ( SMART-lading)
2022-12-21 21:46:16,566 DEBUG : [ZiGateForwarder_16 0] ---> [Unit: 22] 1512.0:1512: 255:4 False ( SMART-lading)
2022-12-21 21:46:16,566 DEBUG : [ZiGateForwarder_16 0] ----> processing WidgetEp: 02, WidgetId: 1246, WidgetType: Meter
2022-12-21 21:46:16,567 DEBUG : [ZiGateForwarder_16 0] ------> ClusterType: Power/Meter/Ampere WidgetEp: 02 WidgetId: 1246
.'
.
But for amps it is 10 times real value:
-
WidgetType: Ampere Attribute_: 0508
2022-12-21 21:46:16,560 DEBUG : [ZiGateForwarder_16 0] ------> SignalLevel: 4 , BatteryLevel: 255
2022-12-21 21:46:16,560 DEBUG : [ZiGateForwarder_16 0] ------> Ampere : 65.59
2022-12-21 21:46:16,560 DEBUG : [ZiGateForwarder_16 0] UpdateDevice_v2 0:65.59: 255: 4:False ( SMART-lading)
2022-12-21 21:46:16,560 DEBUG : [ZiGateForwarder_16 0] ---> [Unit: 31] 0:65.59: 255:4 False ( SMART-lading)
2022-12-21 21:46:16,561 DEBUG : [ZiGateForwarder_16 0] ReadCluster - 0b04 - 1cbc/02 AttrId: 050b AttrType: 29 Attsize: 0002
.
.
Same seen for devive 'Vaskerom -termostat'. 674 watt is 2.904 amps, not 29.04:
WidgetType: Power Attribute_:
2022-12-21 21:46:15,050 DEBUG : [ZiGateForwarder_16 0] ------> SignalLevel: 5 , BatteryLevel: 255
2022-12-21 21:46:15,050 DEBUG : [ZiGateForwarder_16 0] ------> : 674
2022-12-21 21:46:15,051 DEBUG : [ZiGateForwarder_16 0] UpdateDevice_v2 674.0:674: 255: 5:False (Vaskerom -termostat)
2022-12-21 21:46:15,051 DEBUG : [ZiGateForwarder_16 0] ---> [Unit: 41] 674.0:674: 255:5 False (Vaskerom -termostat)
2022-12-21 21:46:15,051 DEBUG : [ZiGateForwarder_16 0] ----> processing WidgetEp: 01, WidgetId: 1322, WidgetType: Meter
2022-12-21 21:46:15,052 DEBUG : [ZiGateForwarder_16 0] ------> ClusterType: Power/Meter/Ampere WidgetEp: 01 WidgetId: 132

WidgetType: Ampere Attribute_: 0508
2022-12-21 21:46:17,090 DEBUG : [ZiGateForwarder_16 0] ------> SignalLevel: 5 , BatteryLevel: 255
2022-12-21 21:46:17,093 DEBUG : [ZiGateForwarder_16 0] ------> Ampere : 29.04
2022-12-21 21:46:17,095 DEBUG : [ZiGateForwarder_16 0] UpdateDevice_v2 0:29.04: 255: 5:False (Vaskerom -termostat)
2022-12-21 21:46:17,099 DEBUG : [ZiGateForwarder_16 0] ---> [Unit: 45] 0:29.04: 255:5 False (Vaskerom -termostat)
2022-12-21 21:46:17,099 DEBUG : [ZiGateForwarder_16 0] ----> processing WidgetEp: 01, WidgetId: 1326, WidgetType: Motion
2022-12-21 21:46:17,100 DEBUG : [ZiGateForwarder_16 0] ------> ClusterType: Power/Meter/Ampere WidgetEp: 01 WidgetId: 1326


And finaly device 'VV tank' that shows 1933662watt instead of the real 1933.662watts or 1.933662 kwatts. 1000 times more than real..
.
Power Attribute_:
2022-12-21 21:37:08,575 DEBUG : [ZiGateForwarder_16 0] ------> SignalLevel: 5 , BatteryLevel: 255
2022-12-21 21:37:08,576 DEBUG : [ZiGateForwarder_16 0] ------> : 1933662.0
2022-12-21 21:37:08,576 DEBUG : [ZiGateForwarder_16 0] UpdateDevice_v2 1933662.0:1933662.0: 255: 5:False ( VV tank)
2022-12-21 21:37:08,580 DEBUG : [ZiGateForwarder_16 0] ---> [Unit: 49] 1933662.0:1933662.0: 255:5 False ( VV tank)
2022-12-21 21:37:08,581 DEBUG : [ZiGateForwarder_16 0] ----> processing WidgetEp: 06, WidgetId: 1338, WidgetType: Meter
2022-12-21 21:37:08,581 DEBUG : [ZiGateForwarder_16 0] ------> ClusterType: Power/Meter WidgetEp: 06 WidgetId: 1338 WidgetType:
.
And also here amps are 10 times more than real, 83.64amps displayed, but in real 8.364amps:
.
WidgetType: Ampere Attribute_: 0508
2022-12-21 21:37:08,756 DEBUG : [ZiGateForwarder_16 0] ------> SignalLevel: 5 , BatteryLevel: 255
2022-12-21 21:37:08,757 DEBUG : [ZiGateForwarder_16 0] ------> Ampere : 83.64
2022-12-21 21:37:08,757 DEBUG : [ZiGateForwarder_16 0] UpdateDevice_v2 0:83.64: 255: 5:False ( VV tank)
2022-12-21 21:37:08,758 DEBUG : [ZiGateForwarder_16 0] ---> [Unit: 51] 0:83.64: 255:5 False ( VV tank)
2022-12-21 21:37:09,539 DEBUG : [ZiGateForwarder_16 0] ReadCluster - 0702 - 2553/06 AttrId: 0400 AttrType: 2a Attsize: 0004

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Friday 23 December 2022 10:41
by pipiche
thanks for the details. will work on it and will revert to you

would you mind sharing once more an export.json so I can get also the information of the new devices you setup

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Friday 23 December 2022 11:13
by pipiche
please refresh to the latest dev branch , the SMART-lading should be ok
for the 2 others I don't know what are they 'VV tank' and 'Vaskerom -termostat'.

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Friday 23 December 2022 12:43
by kaNor
Attached is my latest export ;)

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Friday 23 December 2022 15:54
by pipiche
thanks. Can you get the latest dev and check where we stand. I still didn't find what are 'VV tank' and 'Vaskerom -termostat'.

I also saw that you have a Touch Termostat 16A White from Namron. How does it works , somehow surprise that it is there ;-)
https://zigbee.blakadder.com/Namron_4512737.html

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Friday 23 December 2022 17:41
by kaNor
Did a git pull and restart, Now all devices show correct amps :D Thanks!

Remining problem is the 'VV tank' showing 1000 times real wattage:
Screenshot 2022-12-23 17.15.28.png
Screenshot 2022-12-23 17.15.28.png (224.24 KiB) Viewed 1244 times
'VV tank' is device with IEEE: 540f57fffe227feb model: SOCKETOUTLET1
Link to its datasheet: https://proff.elko.no/getfile.php/13162 ... 540088.pdf


That Namron Termostat is the device i have named 'Vaskerom - termostat'. And as you can see its set-point works well to ;-)
But the selector-switch for mode isn't 100%. But that is not a big issue.
Link to manual: https://www.elektroimportoren.no/docs/l ... ning-5.pdf

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Friday 23 December 2022 19:44
by pipiche
Ok? if you can try once more, the Multiplier and/or the Divisor provide seems to be consistent and tell that they provide directly watts, which seems not the case.

Let see with the change that I have done

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Monday 23 January 2023 21:45
by kaNor
Hi again,

Sorry this case 'got cold' during holidays from my side :|
Anyway; the SOCKETOUTLET1 is still showing 1000 times real wattage. It is only the instant watt value that is wrong. The meter reading for kwh is correct.

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Tuesday 24 January 2023 21:23
by kaNor
Did som search inside logs, and found this:

.
.
2022-12-21 21:46:06,382 DEBUG : [ZiGateForwarder_16 0] ReadCluster - 0702 - 1cbc/02 AttrId: 0000 AttrType: 25 Attsize: 0006 Status: 00 AttrValue: 0000000550e4
2022-12-21 21:46:06,383 DEBUG : [ZiGateForwarder_16 0] decodeAttribute( 25, 0000000550e4)
2022-12-21 21:46:06,384 DEBUG : [ZiGateForwarder_16 0] Cluster0702 - MsgAttrID: 0000 MsgAttType: 25 DataLen: 0006 Data: 0000000550e4 decodedValue: 348388
2022-12-21 21:46:06,387 DEBUG : [ZiGateForwarder_16 0] compute_conso - 0000 Power 348388, div: 1000 --> 348388.0 Watts
2022-12-21 21:46:06,388 DEBUG : [ZiGateForwarder_16 0] Cluster0702 - 0x0000 CURRENT_SUMMATION_DELIVERED Value: 0000000550e4 Conso: 348388.0
.
.
Shouldn't 348388 divided by 1000 end up as 348.388 watts ??

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Thursday 26 January 2023 21:58
by kaNor
In readClusters.py at line 3566:

Changed from:
elif MsgSrcEp in self.ListOfDevices[MsgSrcAddr]["Ep"] and MsgClusterId in self.ListOfDevices[MsgSrcAddr]["Ep"][MsgSrcEp] and "0302" in self.ListOfDevices[MsgSrcAddr]["Ep"][MsgSrcEp][MsgClusterId]:
diviser = self.ListOfDevices[MsgSrcAddr]["Ep"][MsgSrcEp][MsgClusterId]["0302"]
value = round(conso / (diviser / 1000), 3)


to:
elif "0400" in MsgAttrID and MsgSrcEp in self.ListOfDevices[MsgSrcAddr]["Ep"] and MsgClusterId in self.ListOfDevices[MsgSrcAddr]["Ep"][MsgSrcEp] and "0302" in self.ListOfDevices[MsgSrcAddr]["Ep"][MsgSrcEp][MsgClusterId]:
diviser = self.ListOfDevices[MsgSrcAddr]["Ep"][MsgSrcEp][MsgClusterId]["0302"]
value = round(conso / diviser, 3)

Now instant power is displayed correct :D !
Screenshot 2023-01-26 21.55.44.png
Screenshot 2023-01-26 21.55.44.png (67.67 KiB) Viewed 1159 times

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Saturday 28 January 2023 15:56
by pipiche
As exchange on MP, I have re-factor the Metering computation and would appreciate if you could kindly test it.

to do so, you'll have to switch to a development branch

Code: Select all

git pull
git checkout refactor/metering-calculation
git pull
And simply restart the plugin

please let me know the results

If you want to switch back

Code: Select all

git checkout stable6 
/ to switch back to stable6

Code: Select all

git checkout develop 
// to switch back to develop


As you have done some changes in the code, most-likely you won't be able to make the update. The best is

- copy the files you have changes (most likely readCluster.py)
- then do

Code: Select all

git reset --hard
it will remove all changes

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Saturday 28 January 2023 23:50
by kaNor
Hi again,

Switched to refactor/metering-calculation, but plugin dont start at all:

2023-01-28 20:59:28.719 Error: ZiGate: Traceback (most recent call last):
2023-01-28 20:59:28.719 Error: ZiGate: File "/home/pi/domoticz/plugins/Domoticz-Zigate/plugin.py", line 1542, in onStart
2023-01-28 20:59:28.719 Error: ZiGate: _plugin.onStart()
2023-01-28 20:59:28.719 Error: ZiGate: File "/home/pi/domoticz/plugins/Domoticz-Zigate/plugin.py", line 283, in onStart
2023-01-28 20:59:28.719 Error: ZiGate: assert sys.version_info >= (3, 8) # nosec
2023-01-28 20:59:28.719 Error: ZiGate: AssertionError

So I asumed that my python3 was to old and updated with:
wget -qO - https://raw.githubusercontent.com/tvdsl ... /python.sh | sudo bash -s 3.9.16

python3 --version
Python 3.9.16

But plugin didnt start so I edited line 283:
assert sys.version_info >= (3, 4) # nosec

And now it started, but, now Amps are 10 times again, and all devices got power-meters divided by 1000:
Screenshot 2023-01-28 23.37.01.png
Screenshot 2023-01-28 23.37.01.png (193.4 KiB) Viewed 1137 times
So, there i still some work to do here ;-)

Reverting to dev now.

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Sunday 29 January 2023 9:42
by pipiche
really hard to do anything from your comment.
The plugin is now using the device multiplier and divisor, so looks like it is not correct and we need to hack However, I have no clue which device are they.
So if you can give me more details like

export.json from the Plugin Device RAW

Model Name what is wrong

Re: ZigBeeForDomoticZ showing wrong power values

Posted: Monday 30 January 2023 20:09
by kaNor
Hi again,

Did a new checkout of develop yesterday (6.4.2.11) and see that thinks looks better ;)
After some fiddeling around to find out were and how to set these variables, I ended up with:

TS0121.json
"SummationMeteringDivisor": 100,

SOCKETOUTLET1.json
"RMSCurrentDivisor": 1000,
"PowerMeteringDivisor": 1000000

NAMRON/4512737.json (created a new .json-file since this device is not certified yet).
"RMSCurrentDivisor": 1000

(See attached export.json for details.)

Now all values ar correct ! :D :D
Screenshot 2023-01-30 19.47.14.png
Screenshot 2023-01-30 19.47.14.png (329.97 KiB) Viewed 1109 times
PS!! Device 'e2008-lading' has its today use totally wrong now, but should be ok tomorrow. That what happens when setting wrong 'SummationMeteringDivisor'. It realy fu*k up your statistics, so be aware of that when this new version is rolled out..

Now I will send in a request to get the Namron-device certified :)