Closed markhellegers closed 4 years ago
Hello. But you have not 2 websockets notifications, one for each devices, with "power" and "consumption" in all of them ? Or 1 for "power" and 1 for "consumption" (so 4 notifications in total) ?
Your device is a ZHAConsumption and not a ZHAPower ?
If "websocketnotifyall" is set to "true" you normally have the both information in the same notification, so clear the field "buffercommand" and the start of the fonction ProcessAllState() will be enought ? But normally the code check first for "power" then for "consumption" (for the same notification) and the second one overwrite the data with both values and clear the field.
Hello,
I see this in the logging. Hope that makes it clearer:
2020-01-04 20:29:16.685 (Conbee) ### WebSocket Data : {'e': 'changed', 'id': '2', 'r': 'sensors', 'state': {'consumption': 410, 'lastupdated': '2020-01-04T19:29:16'}, 't': 'event', 'uniqueid': '00:15:8d:00:03:42:a7:ab-01-0702'} 2020-01-04 20:29:16.686 (Conbee) ### Update device (Device A - Consumption 2) : {'nValue': 0, 'sValue': '0;410'}, IGNORED , no changes ! 2020-01-04 20:29:17.588 (Conbee) ### WebSocket Data : {'e': 'changed', 'id': '3', 'r': 'sensors', 'state': {'current': 24, 'lastupdated': '2020-01-04T19:29:17', 'power': 3, 'voltage': 236}, 't': 'event', 'uniqueid': '00:15:8d:00:03:42:a7:ab-01-0b04'} 2020-01-04 20:29:17.589 (Conbee) ### Update device (Device A - Power) : {'nValue': 0, 'sValue': '3'}, IGNORED , no changes ! 2020-01-04 20:29:18.491 (Conbee) ### WebSocket Data : {'e': 'changed', 'id': '4', 'r': 'sensors', 'state': {'consumption': 7850, 'lastupdated': '2020-01-04T19:29:18'}, 't': 'event', 'uniqueid': '00:15:8d:00:03:42:f0:8e-01-0702'} 2020-01-04 20:29:18.492 (Conbee) ### Update device (Device B - Consumption 4) : {'nValue': 0, 'sValue': '3;7850'}, IGNORED , no changes ! 2020-01-04 20:29:19.394 (Conbee) ### WebSocket Data : {'e': 'changed', 'id': '5', 'r': 'sensors', 'state': {'current': 0, 'lastupdated': '2020-01-04T19:29:19', 'power': 0, 'voltage': 234}, 't': 'event', 'uniqueid': '00:15:8d:00:03:42:f0:8e-01-0b04'} 2020-01-04 20:29:19.395 (Conbee) ### Update device (Device B - Power) : {'nValue': 0, 'sValue': '0'}, IGNORED , no changes !
The overview in Domoticz says that the consumption device has type "General" and subtype "kWh", while the power device has type "Usage" and subtype "kWh".
Where can I check for "websocketnotifyall". I am still a bit new to Domoticz and the plugin.
Don't worry, you have a message when you start the plugin about this option, but you have it to "true"
And yes, you are right, on your log you are updating" Device B - Consumption 4" with 'consumption' from the notification but with the power from "Device A - Power".
In fact this device create one device for consumption 00:15:8d:00:03:42:a7:ab-01-0702 and one other for power 00:15:8d:00:03:42:a7:ab-01-0b04. Some other device use the same cluster 0b04 only.
Will be easy to correct, like i have said before, I just need to reset the field
clear the field "buffercommand" and the start of the fonction ProcessAllState()
But I need to make some tests, the device created in domoticz use both value, power and consumption, in your situation power will be always 0, because you have it on other device. So I need to check how domoticz will react.
I will give you a code to try tomorrow.
Ok so you have news files here https://github.com/Smanar/Domoticz-deCONZ/tree/beta
But you need to delete your device "(Device X - Consumption)" and restart the plugin after modification, devices will be re-created but as energy counter. You can't have the same device than previously. Some plugs have power and consumption on same device on domoticz, but on your situation you will have them separated.
Noticed the same thing. I also have two innr plugs (SP 120). Beta looks better.
Thanks!
For comparison:
This is a z-wave power plug (PowerNode, not added devices to Domoticz, only use is as repeater):
This is the beta of this plugin with the new devices (2 plugs):
One thing, it doesn't show "Today:" for the "General, Managed Counter" as it does when the type is "General, kWh". Don't know how this will affect the reports (and cost) section yet.
vs
"Elmätare" is a MySensors device counting pulses from my power meter for the house
Sorry for all the edits. Adding info as I go. On small thing triggering my OCD. Added some Aqara vibration sensors: https://github.com/Smanar/Domoticz-deCONZ/blob/9f9566e143d74b31e42d9e7725af48c01f999e9d/plugin.py#L1204 The "d" in "Drop". ;-)
Typo corrected, thx :)
For counter, I m not sure yet ^^. I have, as choose at least
1 - General/Managed counter. 2 - General/KWh 3 - RFXmeter/RFX meter counter.
For sure I can have report and cost for the three. I have checked (on other hardware), but not sure it's working, I think we need at least 24h for a first result.
I need to use fakes values to use the 2, because it works with power and not consumption in reality.
But I haven't understand how they make cumul and use the "today" feature. The three can have it but the display seem random, only the 2 have this line all the time.
For the 2, it 's easy, this device works with power, so domoticz can make calculation itself. But for other, I think it's the device that make calculation and send directly a cumul.
For your server (server kw/h), the value go down, or only increase ?
18 kWh in total since plugging in the innr plug. The server use about 1.5-1.8 kWh/day.
The devices named "Server" shown in my screenshots comes from this plugin (the beta branch)
Ok, so I realy thing it's better to take General/Managed counter, this device is just a counter and only that. If you take a look in the device Elmatare General/kwh, you have on the titlebar, a power and not a comsumption, and you have just under the consumption but just for the day.
Now just need to be sure the report and cost are working corectly.
Yes, I want to see the daily kWh usage to detect any strange deviations from day to day. The last image comes from the Domoticz app's widget.
The MySensors device called "Elmätare" is based on this: https://www.mysensors.org/build/pulse_power (Reports both kWh and Watt back to gateway so the calculation happens in device, the innr plug also reports total kWh usage and current watt usage?)
I have no history at all yet. The kWh-usage keeps going up as it should.
History and report is still empty. It would be great iaf General, kWh could be used.. We need to send the total kWh usage and current watt usage to the (same) device. I think the plug will report that info?
Other plugs will use three devices. The on/off switch, General kWh (kWh and watt) and Usage, Electric (watt). No need for domoticz to calculate kWh or watt, the plug does that.
Yep, but to use the General, kWh, I need to use special value for power, so I prefer use it in last try.
I have just find some new counter
It reset itself, and display today usage But this one make addition itself, if you send 5kw/h then 10 kw/h it will display 15 and not 10.
So I m testing this one ATM You have the actual consumption, and another value on title, but I haven't understand what is it (perhaps daily)
But I have history working on all of them, IDK why it's not working on your machine.
Edit: Ok it's that, you have the cumul on the first line, and on title domoticz, make calculation for daily consumption.
So if you want to make a test, I can configure the second one ? 0.088 is the value send by the device, so it increase itself. 0.089 is a value calculated by domoticz (according to time) for a day.
Edit2: I have open an issue on domoticz to have clarification on how work their counter ....
Some of the counter types use the division you set in Domoticz settings.
It's just a counter counting stuff. I used the RFXMeter counter in my old house. Counting pulses from the power meter (10 000 pulses = 1kWh). It was just that. Counting the number of pulses and Domoticz divided it and made it show in kWh.
I need to read everything again when at my computer.
But this one don't count, it just display the value I send to it (and using the division) !
I have created 2 widgets with the same setting. The first one display the value I send + 1 and the other the value I send - 1.
https://www.domoticz.com/forum/viewtopic.php?f=28&t=30815&p=233096#p233096
Not sure that i fully understand.
This can't be used? https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s#Electricity_.28instant_and_counter.29
Power from the "active power" value from the plug (currently 62 watt):
The ENERGY value from the counter in the plug (currently 20.29 kWh, 20290 Wh since plugged in):
Just guessing here. Sorry, I know too little. I don't know how the data looks from deCONZ. Need to learn Python I guess. ;)
Nope you are right ^^. But your device create 2 widgets in domoticz (because it use 2 differents cluster), one with only power and another with only consumption, it depend on device (some other just create one, use the command on your previous link and are already working), and each of them receive it's own new value.
The domoticz widget general/kwh is a good widget but I will not use at 100% for your device. So I m searching a consumption widget, with daily information.
it exists on domoticz, and domoticz can manage them itself (reset every day for exemple), but I don't find how they work.
The rfxmeter device look good, but it works realy strange during my test. You can check on your widgets, I think you already have one working ? He have
It's just perfect for me, except the strange working mode ....
I don't have any rfxmeter device anymore. When I had, it was a simple 1-wire counter, no kWh, no watt. Domoticz did the calculations.
I do have one z-wave power plug (with almost no load connected). Looks like this:
I also have the MySensors device mentioned before. Looks the same as the z-wave plug. Same type and subtype as the z-wave plug. I could probably do some Lua-scripting and update my own virtual "General, kWh" device if needed to make the innr plugs look like the other power meters.
Give me some days (waiting for return from domoticz community) to make a try.
The rfxmeter will not look like the Zwave kwh Meter. But it will be more usable, for exemple you will have total consumption (not present in zwave widget), the future device will be a widget made just for consumption. IDK how will be the report but I realy think I will be fine.
If, realy, the future widget will be bad, I will make with the general/kwh but I see lot of disadvantages with it.
Ah. I see what you mean. No problem. I can create my own as long as I have access to current watt and (k)Wh value.
Total usage checked using the reports. My energy meter for the whole house (MySensors) is at 14028.009 kWh. Not much of use to see the total usage in the widget for that one 😉..
Thank you for taking your time to look at it!
@NiklasOlofsson Ok so I have a new counter to try > https://github.com/Smanar/Domoticz-deCONZ/commit/87b3c8dedfa2770acee325354de953f26f0c4c54#diff-66c71ea3faaa52c277917c951aa67921
Good point:
Bad point
I have updated my domoticz version, because on previous It log bad value when the counter reset. The widget do the math : Today = actual - previous, but if the counter reset you have actual = 0 so a negative value > bug. I m making test since 2 / 3 days, it seem working now, but you need at least 24h to have correct data.
Pls tell me how you fell this one !
From Domoticz in webbrowser;
Widget from the Domoticz Android app on my home screen.
Seems to work just fine. Will evaluate in a couple of days with some history to talk about.
Thanks!
So, no problem, how is the device ?
If you have same probleme than me with "big number", can you make a screeshoot for I make an issue.
Looking good here. No problem with big numbers. Don't know what will happen if I cut power to the plug. If the counter value is saved in the plug or starts at 0 again. Then, it could lead to problems. I had that problem when using a 1-wire counter and the RFXMeter device a couple of years ago.
And yes, it's that the problem ^^. When you power off the plug, the counter restart to 0, this is something normal on this device I think, but on domoticz side, sometime it works, but sometime the first value is a big one, it will be corrected at first next good value, but on old domoticz version the "fake value" was stored in database, and make report totaly useless.
I have make a post about this https://www.domoticz.com/forum/viewtopic.php?f=28&t=30815&p=233096#p233096 And I m not alone, other counter are buggy too. https://www.domoticz.com/forum/viewtopic.php?f=6&t=30083&p=233353
But without answer, so if you still have the problem, I will make an issue.
I did not have the problem on my last tries, but tell me if you see it (you will see it on report, on dashboard it will be corrected itself by domoticz after some good value)
Just a power cut. Strong winds outside today.
Don't know if the counter in the plug has been reset to 0. Will look in to it.
Edit: No reset. Why the high value then? Strange.
I will just delete the big numbers with shift+click for now. :)
It haven't reset ? The bug is from domoticz code, they just make
total_day = total_send - total_min_today
And I send the cumulated value you have on the device at the device, 828 on your screenshot. Domoticz calculate itself the daily consumption with this formula.
If you make a reset, the send value decomes 0 so you have
total_day = 0 - another_value
And the variable used can't be negative, so you have a "big number".
I think you had a situation where the plugin have received a consumption = 0 (without reset, just bad value). So in this situation, I m agree it's a bug from the plugin (or perhaps deconz, but without log, We'll never know) but if you make a reset you will same problem, so for me, the domoticz code need to be patched too.
I m making a domoticz issue ATM.
@NiklasOlofsson I m trying to simulate your bug, but I can't.
Can you explain what have happened ? You have a power cut during some hours, with the plug and domoticz off ?
I have two innr smartplugs that report the power consumption. However, according to the logging they do this interleaved. This causes the power from one plug to be reported in the consumption of the other.
I looked at the code and the problem seems to be that there is a buffercommand variable that assumes that the last reported power is for the device that is now reporting the consumption. I am not sure what the best fix would be. I would guess best would be to know which device the power is registered for.