Closed sander1988 closed 4 years ago
There is an issue with the batteryLevel param of a device in DzVents. It sometimes contains a wrong value for some devices in DzVents. It seems DzVents is only updating the batteryLevel when Domoticz restarts.
This is known issue described In this forum post
Where also a workaround is provided.
In short: dzVvents ( and Lua and Blockly) does get the batteryLevel data from the domoticz main Eventsystem and at that level the choice was made to collect the batteryLevel once when the eventSystem got started. (I guess this choice was made with performance in mind)
Thanks for the forujm post. I used a similar workaround.
If you all agree it's not a bug but a choice for better performance then we can close this issue (the workaround is fine). But it feels a bit like a bug to me.
Not sure.. when a sensor is updated it should also update the battery level
Please correct me if I am wrong but if I understand the code correctly, the battery level is only updated in the data send from the event system when domoticz or the eventSystem is (re)started or when CEventSystem::GetCurrentStates() gets called. This can take a long time on a stable system.
I can't have a look at the code this moment but the eventsystem is called when a sensor is updated and when it is updated it does have the battery level. If this is not send to the event system then it might needs a little tweak
I can't have a look at the code this moment but the eventsystem is called when a sensor is updated and when it is updated it does have the battery level. If this is not send to the event system then it might needs a little tweak
Good to mention: I have tested this case by triggering the door sensor (by opening the door). The (open/closed) state is updated correctly but the battery level (in DzVents) stays on it's initial value.
Good to mention: I have tested this case by triggering the door sensor (by opening the door). The (open/closed) state is updated correctly but the battery level (in DzVents) stays on it's initial value.
I've got same result.
Today I've changed the battieries to a device that report low value
2020-02-01 21:32:00.157 Status: dzVents: Info: BatteryLevel: DEVICE : 126 PIR ALARM P2 SALA - BATTERY LEVEL : 19
Forgot to write down my system information :
Version: 4.11657
Build Hash: 1d05ce754
Compile Date: 2020-01-27 09:08:42
dzVents Version: 2.5.7
Python Version: 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0]
I think we should also be able to test this when updating a dummy device via the JSON method ? (udevice and add &rssi=10&battery=89)
&rssi=10&battery=89
Same result : just update an alredy present dummy device (wich have not battery value). Domoticz show correct value DzVents report nil
@gizmocuz This script to dump relevant attributes (only showing some here) show that the battery- and signal levels are not send on update to the event system but are send on domoticz start.
return
{
on =
{
timer =
{
'every minute',
},
},
execute = function(dz)
item = dz.devices('testDevice') -- airQuality device
dz.utils.dumpTable(item._data)
end
}
After creation, before update
2020-02-03 00:06:00.503 Status: dzVents: Info: ------ Start internal script: Script #8:, trigger: every minute
2020-02-03 00:06:00.511 Status: dzVents: > deviceType: Air Quality
2020-02-03 00:06:00.511 Status: dzVents: > batteryLevel: 255
2020-02-03 00:06:00.511 Status: dzVents: > signalLevel: 12
2020-02-03 00:06:00.511 Status: dzVents: > subType: Voltcraft CO-20
2020-02-03 00:06:00.511 Status: dzVents: > name: testDevice
2020-02-03 00:06:00.512 Status: dzVents: > data:
2020-02-03 00:06:00.512 Status: dzVents: > _nValue: 0
2020-02-03 00:06:00.512 Status: dzVents: > _state: 0
2020-02-03 00:06:00.512 Status: dzVents: > lastUpdate: 2020-02-02 23:55:08
2020-02-03 00:06:00.512 Status: dzVents: Info: ------ Finished Script #8
After http://192.168.192.115:8084/json.htm?type=command¶m=udevice&idx=83&nvalue=121&rssi=10&battery=89
2020-02-03 00:07:00.538 Status: dzVents: Info: ------ Start internal script: Script #8:, trigger: every minute
2020-02-03 00:07:00.546 Status: dzVents: > signalLevel: 12
2020-02-03 00:07:00.546 Status: dzVents: > deviceType: Air Quality
2020-02-03 00:07:00.546 Status: dzVents: > name: testDevice
2020-02-03 00:07:00.546 Status: dzVents: > batteryLevel: 255
2020-02-03 00:07:00.546 Status: dzVents: > data:
2020-02-03 00:07:00.546 Status: dzVents: > _nValue: 121
2020-02-03 00:07:00.546 Status: dzVents: > _state: 121
2020-02-03 00:07:00.546 Status: dzVents: > switchTypeValue: 0
2020-02-03 00:07:00.546 Status: dzVents: > subType: Voltcraft CO-20
2020-02-03 00:07:00.546 Status: dzVents: > lastUpdate: 2020-02-03 00:06:55
2020-02-03 00:07:00.546 Status: dzVents: Info: ------ Finished Script #8
After domoticz service stop / domoticz service start
2020-02-03 00:15:00.509 Status: dzVents: Info: ------ Start internal script: Script #8:, trigger: every minute
2020-02-03 00:15:00.518 Status: dzVents: > id: 83
2020-02-03 00:15:00.518 Status: dzVents: > batteryLevel: 89
2020-02-03 00:15:00.518 Status: dzVents: > data:
2020-02-03 00:15:00.518 Status: dzVents: > _nValue: 121
2020-02-03 00:15:00.519 Status: dzVents: > _state: 121
2020-02-03 00:15:00.519 Status: dzVents: > lastUpdate: 2020-02-03 00:06:55
2020-02-03 00:15:00.519 Status: dzVents: > deviceType: Air Quality
2020-02-03 00:15:00.519 Status: dzVents: > signalLevel: 10
2020-02-03 00:15:00.519 Status: dzVents: > name: testDevice
2020-02-03 00:15:00.519 Status: dzVents: > switchTypeValue: 0
2020-02-03 00:15:00.519 Status: dzVents: > subType: Voltcraft CO-20
2020-02-03 00:15:00.519 Status: dzVents: Info: ------ Finished Script #8
Any new insights ?
this issue pops up every couple of weeks on the forum.
Nope , only that zwave users have to wait until the battery level is actually received ! That can take a day, depending on the configuration For all others, nothing changed, nothing new... should work
@gizmocuz I have the same problem as here but the batery level from zwawe is already updated only device is not updated. Take a look at: https://www.domoticz.com/forum/viewtopic.php?f=6&t=32015&p=242159#p242159
warren describe this as the bug 'updating device only when events starts ;('
Could you try if this is working ?
https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s#Getting_the_battery_levels
If that works correctly we know it could be dzVents related
From Json api correct it's node 9 and now is 9% as it is on zwave and on dzvents I have still 16%
{ "result": [ { "battery": 255, "nodeID": 1, "nodeName": "Controller" }, { "battery": 255, "nodeID": 3, "nodeName": "Unknown" }, { "battery": 255, "nodeID": 4, "nodeName": "Unknown" }, { "battery": 255, "nodeID": 5, "nodeName": "Unknown" }, { "battery": 100, "nodeID": 7, "nodeName": "Unknown" }, { "battery": 9, "nodeID": 9, "nodeName": "Unknown" }, { "battery": 45, "nodeID": 10, "nodeName": "Unknown" }, { "battery": 6, "nodeID": 11, "nodeName": "Unknown" }, { "battery": 96, "nodeID": 12, "nodeName": "Unknown" }, { "battery": 255, "nodeID": 8, "nodeName": "Unknown" }, { "battery": 100, "nodeID": 13, "nodeName": "Unknown" } ], "status": "OK", "title": "GetBatteryLevels"
ON dzVents script I have
batery = domoticz.devices(60).batteryLevel domoticz.log( 'TEST ' .. batery , domoticz.LOG_INFO)
OUTPUT 2020-04-03 18:16:00.187 Status: dzVents: Info: TEST 16
Yes that is by design. The batterylevel is only send from the eventsystem to Lua and dzVents at certain moments. in EventSystem.cpp
CEventSystem::GetCurrentStates()
Just try to force a "EventSystem: reset all device statuses..." either by
(re)start domoticz update an internal dzVents script or create a new one creating a device wait until 00:00
only when any of these event occur CEventSystem::GetCurrentStates() is called and batterylevel and signalLevel are passed to dzVents and Lua
I expect that it is coded like this for performance reasons. That is also why I am hesitant to collect this information from the database in dzVents.cpp. It is a reletive heavy call to get up to date data for attributes that are by nature not very dynamic.
hmm in my opinion it doesn't make sense. If zwave device on OZ has a proper values (updated last seen batery etc.) and on device tab there is no refresh (last seen yesterday) and when you hover mouse on the batery it will show you right value then for me there is something wrong. Im not argue that you are not right but take a closer look at this. Maybe it design flaw and should be changed. Im not see the point of doing that if the parameters are there.
I will see if i can already add the battery value from the 'addvalue' message instead of the 'updatevalue'
Okey, So i checked the internal zwave code again, and the battery state was already loaded at startup. So if the battery level is present in the devices tab, I would say it should be available in dzVents as well @rwaaren , not sure I understand, but could we not add the battery level in a table like we do in CEventSystem::GetCurrentMeasurementStates ? I also see that the battery level is taken in 'CEventSystem::GetCurrentStates'
I don't see anything done with it in 'CEventSystem::ProcessDevice', meaning that the call to 'UpdateSingleState' does not have a parameter for the batterylevel, and does not update it's level ? Should that not be added here as well ?
I am currently working on a patch that parses the batterylevel to UpdateSingleState, hope to report back shortly (after doing some (dzVents) tests)
Okey, so in the current development code I added the battery level to UpdateSingleState This means that the m_devicestates should always have a up2date battery level
But it seems nothing is done with this value...
@rwaaren , could we use this value somewhere to have an always up2date value ?
Is it not already in line 870 of dzVents.cpp ? Will check today. Compiling now
@rwaaren , you could be right!! That would mean that it should work better now ;)
@rwaaren @gizmocuz the last seen column on device tab should be also refreshed
Checked in build 11894 and it works different now. When the battery Level of a virtual sensor is updated via JSON, the new level is immediately available in dzVents and correct..
In a test with an openZwave temp/humidity (I replaced batteries in my Everspring sensor) a change of the batteryLevel is visible in Zwave and device tab of the GUI and updated correctly in the database but something strange seems to happen.
batterylevel in Zwave
Batterylevel in GUI
BatteryLevel passed to dzVents: (some stop / start in between)
2020-04-04 12:47:00.280 Status: dzVents: !Info: (591) Badkamer zwave; batteryLevel 10
2020-04-04 12:48:01.572 Status: dzVents: !Info: (591) Badkamer zwave; batteryLevel 50
2020-04-04 12:49:00.331 Status: dzVents: !Info: (591) Badkamer zwave; batteryLevel 50
2020-04-04 12:53:00.428 Status: dzVents: !Info: (591) Badkamer zwave; batteryLevel 50
2020-04-04 12:54:01.153 Status: dzVents: !Info: (591) Badkamer zwave; batteryLevel 50
2020-04-04 12:55:00.483 Status: dzVents: !Info: (591) Badkamer zwave; batteryLevel 50
2020-04-04 12:56:00.485 Status: dzVents: !Info: (591) Badkamer zwave; batteryLevel 0
2020-04-04 12:57:00.504 Status: dzVents: !Info: (591) Badkamer zwave; batteryLevel 10
2020-04-04 12:58:00.522 Status: dzVents: !Info: (591) Badkamer zwave; batteryLevel 10
2020-04-04 12:59:00.543 Status: dzVents: !Info: (591) Badkamer zwave; batteryLevel 10
2020-04-04 13:00:03.440 Status: dzVents: !Info: (591) Badkamer zwave; batteryLevel 10
@rwaaren , I think the only way to debug it closer in this case is to enable the openzwave debug log, and see if you also got the 0 value in between in here, if yes, then this is what the node/ozw sends So it works better now ?
In my opinion it's worse now because its unpredictable. Have to debug more to understand what is happening also because other types (eg Xiaomi) does not seem to have this issue. Might take some time to get to the bottom of it.
2020-04-04 15:19:02.060 [7f37c9116700] Debug: SQLH UpdateValueInt Badkamer zwave HwID:4 DevID:3073 Type:82 sType:5 nValue:0 sValue:20.8;37;1 2020-04-04 15:19:02.063 [7f37c9116700] subtype = TH5 - WTGR800 Sequence nbr = 0 ID = 3073 Temperature = 20.8 C Humidity = 37 % Status = Comfortable Signal level = 12 Battery = OK
This is what I see if I switch on all debug logging in domoticz. Other Battery level I see from this Zwave hardware is LOW
Could that be an issue with this change ? .Other hardware send integers.
@rwaaren Try to enable DEBUG on the zwave controller (see image) After that look at OZW_Log.txt (in my system in domoticz/Config/OZW_Log.txt)
I think you migh have to see for any update, a correspiending update on that Log file
Node076 report 45%
2020-04-04 11:23:54.808 Info, Node076, Received Battery report from node 76: level=45
Node084 report 0%
2020-04-04 16:06:58.827 Info, Node084, Received Battery report from node 84: level=0
Thx.
This corresponds with my previous OK and LOW debug messages
2020-04-04 16:27:31.873 Info, Node012, Received Battery report from node 12: level=100 2020-04-04 16:27:38.738 Info, Node006, Received Battery report from node 6: level=0
@rwaaren
but something strange seems to happen.
What do you mean ?
What do you mean ?
somewhere between the sensor and dzVents generic_device.lua the value changes from 100 to 0,10 and 50 and this is not what I see for other battery values. I want to understand where and why this happens.
Added an extra _log in
EventSystem.cpp line 1407 _log.Log(LOG_STATUS, "EventSystem: Name= %s, batterLevel= %d", l_deviceName.c_str(), batteryLevel);
dzVents.cpp line 871 _log.Log(LOG_STATUS, "dzVents: ID= %d, Name= %s, batterLevel= %d", sitem.ID, sitem.deviceName.c_str(), sitem.batteryLevel);
This is what EventSystem.cpp and dzVents.cpp collects from the eventSystem
(using for (iterator = m_mainworker.m_eventsystem.m_devicestates.begin(); iterator != m_mainworker.m_eventsystem.m_devicestates.end(); ++iterator) )
2020-04-04 18:15:18.040 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 10
2020-04-04 18:15:21.470 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 10
2020-04-04 18:15:21.851 Status: EventSystem: Name= Badkamer zwave, batterLevel= 50
2020-04-04 18:15:21.854 (Aeotec Zwave stick) Temp + Humidity (Badkamer zwave)
2020-04-04 18:15:21.861 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 50
2020-04-04 18:15:22.478 Status: EventSystem: Name= Badkamer zwave, batterLevel= 50
2020-04-04 18:15:22.481 (Aeotec Zwave stick) Temp + Humidity (Badkamer zwave)
2020-04-04 18:15:22.487 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 50
In Zwave overview and in device tab batteryLevel for this device is 100
2020-04-04 18:15:18.040 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 10
2020-04-04 18:15:21.470 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 10
2020-04-04 18:15:21.851 Status: EventSystem: Name= Badkamer zwave, batterLevel= 50
2020-04-04 18:15:21.854 (Aeotec Zwave stick) Temp + Humidity (Badkamer zwave)
2020-04-04 18:15:21.861 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 50
2020-04-04 18:15:22.478 Status: EventSystem: Name= Badkamer zwave, batterLevel= 50
2020-04-04 18:15:22.481 (Aeotec Zwave stick) Temp + Humidity (Badkamer zwave)
2020-04-04 18:15:22.487 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 50
What do you have in OZW_Log for this Node at that time ?
domoticz.log
2020-04-04 20:10:04.064 Status: Domoticz V2020.1 (build 11895) (c)2012-2020 GizMoCuz
2020-04-04 20:10:04.064 Status: Build Hash: 553c17615-modified, Date: 2020-04-04 12:34:38
2020-04-04 20:10:04.084 Status: Startup Path: /opt/domoticz/
2020-04-04 20:10:06.641 Status: OpenZWave: using config in: /opt/domoticz/Config/
2020-04-04 20:10:06.657 Status: OpenZWave: Starting...
2020-04-04 20:10:06.657 Status: OpenZWave: Version: 1.6-1004-g71220f43
2020-04-04 20:10:07.641 OpenZWave: Value_Added: Node: 6 (0x06), CommandClass: SENSOR MULTILEVEL, Label: Instance 1: Air Temperature, Instance: 1, Index: 1
2020-04-04 20:10:07.641 OpenZWave: Value_Added: Node: 6 (0x06), CommandClass: SENSOR MULTILEVEL, Label: Instance 1: Humidity, Instance: 1, Index: 5
2020-04-04 20:10:07.641 OpenZWave: Value_Added: Node: 6 (0x06), CommandClass: SENSOR MULTILEVEL, Label: Instance 2: Humidity, Instance: 2, Index: 5
2020-04-04 20:10:07.641 OpenZWave: Value_Added: Node: 6 (0x06), CommandClass: ALARM, Label: Alarm Type, Instance: 1, Index: 512
2020-04-04 20:10:07.642 OpenZWave: Value_Added: Node: 6 (0x06), CommandClass: ALARM, Label: Alarm Level, Instance: 1, Index: 513
2020-04-04 20:10:07.642 OpenZWave: Value_Added: Node: 6 (0x06), CommandClass: BATTERY, Label: Battery Level, Instance: 1, Index: 0
2020-04-04 20:10:07.642 OpenZWave: Value_Added: Node: 8 (0x08), CommandClass: SENSOR BINARY, Label: Sensor, Instance: 1, Index: 0
2020-04-04 20:10:07.643 OpenZWave: Value_Added: Node: 8 (0x08), CommandClass: SENSOR MULTILEVEL, Label: Air Temperature, Instance: 1, Index: 1
2020-04-04 20:10:07.643 OpenZWave: Value_Added: Node: 8 (0x08), CommandClass: SENSOR MULTILEVEL, Label: Illuminance, Instance: 1, Index: 3
2020-04-04 20:10:07.643 OpenZWave: Value_Added: Node: 8 (0x08), CommandClass: BATTERY, Label: Battery Level, Instance: 1, Index: 0
2020-04-04 20:10:07.644 OpenZWave: Value_Added: Node: 8 (0x08), CommandClass: SENSOR ALARM, Label: General, Instance: 1, Index: 0
2020-04-04 20:10:07.644 OpenZWave: Value_Added: Node: 12 (0x0c), CommandClass: SENSOR MULTILEVEL, Label: Instance 1: Air Temperature, Instance: 1, Index: 1
2020-04-04 20:10:07.644 OpenZWave: Value_Added: Node: 12 (0x0c), CommandClass: SENSOR MULTILEVEL, Label: Instance 1: Humidity, Instance: 1, Index: 5
2020-04-04 20:10:07.644 OpenZWave: Value_Added: Node: 12 (0x0c), CommandClass: SENSOR MULTILEVEL, Label: Instance 2: Humidity, Instance: 2, Index: 5
2020-04-04 20:10:07.645 OpenZWave: Value_Added: Node: 12 (0x0c), CommandClass: BATTERY, Label: Battery Level, Instance: 1, Index: 0
2020-04-04 20:10:07.645 OpenZWave: Value_Added: Node: 14 (0x0e), CommandClass: SWITCH BINARY, Label: Switch, Instance: 1, Index: 0
2020-04-04 20:10:07.647 OpenZWave: Value_Added: Node: 16 (0x10), CommandClass: SWITCH BINARY, Label: Switch, Instance: 1, Index: 0
2020-04-04 20:10:07.647 OpenZWave: Value_Added: Node: 16 (0x10), CommandClass: METER, Label: Electric - kWh, Instance: 1, Index: 0
2020-04-04 20:10:07.647 OpenZWave: Value_Added: Node: 16 (0x10), CommandClass: METER, Label: Electric - W, Instance: 1, Index: 2
2020-04-04 20:10:07.647 OpenZWave: Value_Added: Node: 16 (0x10), CommandClass: METER, Label: Electric - V, Instance: 1, Index: 4
2020-04-04 20:10:07.647 OpenZWave: Value_Added: Node: 16 (0x10), CommandClass: METER, Label: Electric - A, Instance: 1, Index: 5
2020-04-04 20:10:07.647 OpenZWave: Value_Added: Node: 16 (0x10), CommandClass: METER, Label: Exporting, Instance: 1, Index: 256
2020-04-04 20:10:07.648 OpenZWave: Value_Added: Node: 16 (0x10), CommandClass: ALARM, Label: Power Management, Instance: 1, Index: 8
2020-04-04 20:10:07.648 OpenZWave: Value_Added: Node: 16 (0x10), CommandClass: ALARM, Label: Previous Event Cleared, Instance: 1, Index: 256
2020-04-04 20:10:07.648 OpenZWave: Value_Added: Node: 18 (0x12), CommandClass: SWITCH BINARY, Label: Switch, Instance: 1, Index: 0
2020-04-04 20:10:11.406 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 0
2020-04-04 20:10:11.807 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 0
2020-04-04 20:10:11.890 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 0
2020-04-04 20:11:20.245 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 0
.....
2020-04-04 20:13:01.096 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 0
2020-04-04 20:13:03.331 Status: EventSystem: Name= Badkamer zwave, batterLevel= 10
2020-04-04 20:13:03.336 (Aeotec Zwave stick) Temp + Humidity (Badkamer zwave)
2020-04-04 20:13:03.342 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 10
2020-04-04 20:13:03.959 Status: EventSystem: Name= Badkamer zwave, batterLevel= 10
2020-04-04 20:13:03.961 (Aeotec Zwave stick) Temp + Humidity (Badkamer zwave)
2020-04-04 20:13:03.972 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 10
2020-04-04 20:13:08.402 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 10
2020-04-04 20:13:11.041 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 10
2020-04-04 20:13:11.118 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 10
2020-04-04 20:13:11.323 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 10
2020-04-04 20:13:11.404 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 10
....
2020-04-04 20:17:51.774 Status: EventSystem: Name= Badkamer zwave, batterLevel= 50
2020-04-04 20:17:51.775 (Aeotec Zwave stick) Temp + Humidity (Badkamer zwave)
2020-04-04 20:17:51.777 (P1) Usage (Delivery L1)
2020-04-04 20:17:51.856 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 50
2020-04-04 20:17:52.383 Status: EventSystem: Name= Badkamer zwave, batterLevel= 50
2020-04-04 20:17:52.386 (Aeotec Zwave stick) Temp + Humidity (Badkamer zwave)
2020-04-04 20:17:52.393 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 50
2020-04-04 20:17:55.163 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 50
....
2020-04-04 21:27:11.852 Status: dzVents: ID= 591, Name= Badkamer zwave, batterLevel= 50
OZW_Log
2020-04-04 20:11:43.972 Info, Node006, Received Battery report from node 6: level=0
2020-04-04 20:13:55.499 Info, Node012, Received Battery report from node 12: level=100
2020-04-04 20:14:42.723 Info, Node006, Received Battery report from node 6: level=0
2020-04-04 20:17:42.354 Info, Node006, Received Battery report from node 6: level=0
2020-04-04 20:20:42.025 Info, Node006, Received Battery report from node 6: level=0
2020-04-04 20:23:41.650 Info, Node006, Received Battery report from node 6: level=0
2020-04-04 20:26:41.321 Info, Node006, Received Battery report from node 6: level=0
2020-04-04 20:29:41.022 Info, Node006, Received Battery report from node 6: level=0
2020-04-04 20:32:40.651 Info, Node006, Received Battery report from node 6: level=0
2020-04-04 20:35:40.316 Info, Node006, Received Battery report from node 6: level=0
2020-04-04 20:38:39.978 Info, Node006, Received Battery report from node 6: level=0
2020-04-04 20:39:40.161 Info, Node008, Received Battery report from node 8: level=74
2020-04-04 20:41:39.685 Info, Node006, Received Battery report from node 6: level=0
2020-04-04 20:44:39.348 Info, Node006, Received Battery report from node 6: level=0
2020-04-04 20:47:39.006 Info, Node006, Received Battery report from node 6: level=0
....
2020-04-04 21:23:34.872 Info, Node006, Received Battery report from node 6: level=0
database (no changes in batterylevel)
sqlite> select id, name, batterylevel from devicestatus where id = 591;
ID|Name|BatteryLevel
591|Badkamer zwave|100
@rwaaren What ZWave Node ID is Domoticz Device ID 591 (Badkamer) ? Is OZW_Log the full log (I can see only level 0, 100 and 74, and never find a report with level=10) ?
I mean .......... are you able to find the two "Battery report" (around 20:13:03) that report battery level at 10 ?
@rwaaren What ZWave Node ID is Domoticz Device ID 591 (Badkamer) ?
0C == 12
Is OZW_Log the full log (I can see only level 0, 100 and 74, and never find a report with level=10) ?
There was never send a level=10
I mean .......... are you able to find the two "Battery report" (around 20:13:03) that report battery level at 10 ?
No
But I think I am on to something. I have two same Everspring temp/hum sensors and one of them had polling On. I changed two of the three batteries and in OZW it reported 70%.
I restarted domoticz at 23:27 and at 23:38 it started to report the same %-age in domoticz eventSystem as in OZW (70%)
2020-04-04 23:29:00.249 Status: dzVents: !Info: Meterkast temperatuur ,batterLevel: 0
2020-04-04 23:30:01.371 Status: dzVents: !Info: Meterkast temperatuur ,batterLevel: 0
2020-04-04 23:31:00.306 Status: dzVents: !Info: Meterkast temperatuur ,batterLevel: 0
2020-04-04 23:32:00.320 Status: dzVents: !Info: Meterkast temperatuur ,batterLevel: 10
2020-04-04 23:33:00.345 Status: dzVents: !Info: Meterkast temperatuur ,batterLevel: 10
2020-04-04 23:34:00.378 Status: dzVents: !Info: Meterkast temperatuur ,batterLevel: 10
2020-04-04 23:35:00.453 Status: dzVents: !Info: Meterkast temperatuur ,batterLevel: 10
2020-04-04 23:36:01.637 Status: dzVents: !Info: Meterkast temperatuur ,batterLevel: 10
2020-04-04 23:37:00.461 Status: dzVents: !Info: Meterkast temperatuur ,batterLevel: 10
2020-04-04 23:38:00.494 Status: dzVents: !Info: Meterkast temperatuur ,batterLevel: 70
Then I changed also the last battery at 00:19 for a fresh one and in OZW it started to report 100%
in domoticz EventSystem it changed at 00:21 from batteryLevel 70 to 50
So now I see two devices in domoticz GUI showing 100% battery and passing 50 from the eventsystem.
@rwaaren , is it possible to add some debug logging here:
void CEventSystem::ProcessDevice(
Sure but please tell me what you want and where ? I tried something but got a segmentation fault. Probably did something stupid in C++ terms
@rwaaren , This function is called on every device update (From UpdateValueInt), and should contain the correct battery level I wonder if it reports wrong here as well...
Yes it there reports 50 as well (while 100 in Zwave debug and in GUI ( Devices tab )
Line 1510 of EventSystem.cpp
if (HardwareID == 4) // Zwave
{
_log.Log(LOG_STATUS, "EventSystem:ProcessDevice ((ID=%" PRIu64 ": devicename= %s: batterylevel= %d ) ", ulDevID, devname.c_str(), batterylevel );
}
log (after stop / start at 18:10)
2020-04-05 18:11:12.671 Status: EventSystem:ProcessDevice ((ID=2745: devicename= Meterkast temperatuur: batterylevel= 0 )
2020-04-05 18:11:57.999 Status: EventSystem:ProcessDevice ((ID=2745: devicename= Meterkast temperatuur: batterylevel= 50 )
2020-04-05 18:11:58.822 Status: EventSystem:ProcessDevice ((ID=2745: devicename= Meterkast temperatuur: batterylevel= 50 )
2020-04-05 18:12:01.656 Status: EventSystem:ProcessDevice ((ID=591: devicename= Badkamer zwave: batterylevel= 50 )
2020-04-05 18:12:02.483 Status: EventSystem:ProcessDevice ((ID=591: devicename= Badkamer zwave: batterylevel= 50 )
2020-04-05 18:12:04.083 Status: EventSystem:ProcessDevice ((ID=2745: devicename= Meterkast temperatuur: batterylevel= 50 )
And also in SQLHelper:UpdateValueInt it shows 50 when it is 100
@rwaaren , Hmmm I wonder where it does get that value from... Is it possible to debug 'ZWaveBase::SendDevice2Domoticz' ? specifically the top part right under
int BatLevel = pDevice->batValue;
But also before
SendTempHumSensor(NodeID, BatLevel, pDevice->floatValue, pHumDevice->intvalue, devName.c_str());
SendTempSensor(NodeID, BatLevel, pDevice->floatValue, (!pDevice->label.empty()) ? pDevice->label.c_str() : "Temperature");
I have a very good idea where it goes wrong...
The internal temperature structure has a 4 bit field for the temperature (RFXCom), and I think we have to call 'Convert_Battery_To_PercInt' when calling the 'SendTempyyyy' functions
I hope to debug this today as well
Is it possible to debug 'ZWaveBase::SendDevice2Domoticz' ? specifically the top part right under int BatLevel = pDevice->batValue;
in Zwave 100 in EventSystem 50
But also before
SendTempHumSensor(NodeID, BatLevel, pDevice->floatValue, pHumDevice->intvalue, devName.c_str());
Beta 11922 should solve this issue, if possible please let us know...
An (unexpected) side-effect is described on this forum pst
in short:
At a restart of Domoticz the Z-wave battery powered devices have battery level 0 in Domoticz, in the Z-Wave control panel. Then after the device checks in, for sending the temp or so, Domoticz takes over the current level from the device and the level is correct in both Domoticz and Z-wave control panel.
So the first couple of minutes the batterylevel in domoticz is 0 causing the internal Battery Low Level notification ( [Setup] [Settings] [Other] Batteryleve ) to alert about low battery when set > 0.
@rwaaren , you say this is also in the control panel ? The solution would be to ignore battery values with a value 0 ?
Hi @gizmocuz
No, in the OZW control panel the values are correct. Only in Domoticz they are 0.
I think it would be best to keep the old value instead of 0, if that is even possible..
@darkrain-nl , I suspect something else is causing this issue... We do not know the old values... In the control panel they are okey... then I suspect this is also the case in the Domoticz devices table?
No that is not the case, the device table also shows 0. I can btw pretty easy reproduce it, so if you want me to try something just let me know.
There is an issue with the batteryLevel param of a device in DzVents. It sometimes contains a wrong value for some devices in DzVents. It seems DzVents is only updating the batteryLevel when Domoticz restarts.
I have seen this for several doorsensors (switches). The web GUI of Domoticz shows it correctly.
Version info: Platform: Raspberry Pi Version: 4.10717 Build Hash: b38b49e5 Compile Date: 2019-05-09 13:04:08 dzVents Version: 2.4.19 Python Version: 3.7.3 (default, Apr 3 2019, 05:39:12) [GCC 8.2.0]