How can I best debug dzVents?  [SOLVED]

Moderator: leecollings

EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: How can I best debug dzVents?

Post by EddyG »

So I installed the zigbee plugin on an almost virgin domoticz test system.
Got the same error

Code: Select all

2021-08-13 21:55:23.790 Error: EventSystem: in /opt/domoticz/dzVents/runtime/dzVents.lua: ...oticz/dzVents/runtime/device-adapters/generic_device.lua:67: attempt to index a nil value (field '_')
My problem is I cannot find which device is causing the error.
Have set full debugging on and hope for the best.....
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: How can I best debug dzVents?

Post by EddyG »

It get even funnier. I have 1 script running on that official docker Domoticz test system ( version 2021.1 build 13360).
A copied that script from the examples, nothing special in the script.
Spoiler: show
return {
active = true,
on = {
devices = {
'Internal Temperature'
}
},
execute = function(domoticz, mySensor)

if (mySensor.temperature > 45) then
domoticz.notify('Hey!', 'The house might be on fire!!',
domoticz.PRIORITY_EMERGENCY,
domoticz.SOUND_SIREN)
domoticz.log('Temperatuur boven 45 graden', domoticz.LOG_ERROR)
end

end
}
This is part of the logfile around the error. So the question is why is the Domoticz event system triggered?

Code: Select all

2021-08-14 07:25:40.771  Status: dzVents: Info: Handling events for: "Internal Temperature", value: "42.4"
2021-08-14 07:25:40.771  Status: dzVents: Info: ------ Start external script: get sensor values.lua: Device: "Internal Temperature (Motherboard)", Index: 1
2021-08-14 07:25:40.771  Status: dzVents: Info: ------ Finished get sensor values.lua
2021-08-14 07:25:41.174  zigbee2mqtt: (zigbee2mqtt) MQTT message: zigbee2mqtt/bridge/logging {'level': 'info', 'message': 'MQTT publish: topic \'zigbee2mqtt/AchterdeurSW\', payload \'{"battery":100,"contact":true,"last_seen":"2021-08-14T07:25:40+02:00","linkquality":54,"temperature":25,"voltage":3055}\''}
2021-08-14 07:25:41.174  zigbee2mqtt: (zigbee2mqtt) MQTT message: zigbee2mqtt/AchterdeurSW {'battery': 100, 'contact': True, 'last_seen': '2021-08-14T07:25:40+02:00', 'linkquality': 54, 'temperature': 25, 'voltage': 3055}
2021-08-14 07:25:41.780  zigbee2mqtt: (zigbee2mqtt) MQTT message: zigbee2mqtt/bridge/logging {'level': 'info', 'message': 'MQTT publish: topic \'zigbee2mqtt/ZolderTHB\', payload \'{"battery":100,"humidity":48.8,"last_seen":"2021-08-14T07:25:40+02:00","linkquality":147,"pressure":1017.9,"temperature":25.9,"voltage":3025}\''}
2021-08-14 07:25:41.781  zigbee2mqtt: (zigbee2mqtt) MQTT message: zigbee2mqtt/ZolderTHB {'battery': 100, 'humidity': 48.8, 'last_seen': '2021-08-14T07:25:40+02:00', 'linkquality': 147, 'pressure': 1017.9, 'temperature': 25.9, 'voltage': 3025}
2021-08-14 07:25:41.913  Error: EventSystem: in /opt/domoticz/dzVents/runtime/dzVents.lua: ...oticz/dzVents/runtime/device-adapters/generic_device.lua:67: attempt to index a nil value (field '_')
2021-08-14 07:25:48.364  zigbee2mqtt: (zigbee2mqtt) MQTT message: zigbee2mqtt/bridge/logging {'level': 'info', 'message': 'MQTT publish: topic \'zigbee2mqtt/Garage\', payload \'{"battery":100,"humidity":71.1,"last_seen":"2021-08-14T07:25:48+02:00","linkquality":39,"temperature":15.7,"voltage":2100}\''}
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: How can I best debug dzVents?

Post by EddyG »

And just for reference, I have several Domoticz systems running, even 1 system, which is up for more then a year, of which the Linux system never went down for the last 1070 days. And that Domoticz system has NO error at all.
Spoiler: show
Version: 4.9700
Build Hash: a3a45906
Compile Date: 2018-06-23 16:24:51
dzVents Version: 2.4.6
Python Version: 3.4.2 (default, Sep 16 2019, 20:33:47) [GCC 4.9.2]

Uptime: 453 Days, 20 Hours, 10 Minutes, 40 Seconds
I have a few other Raspberry Domoticz running which don't show any errors, or only induced by me.
These errors come from zigbee2mqtt service, the zigbee2mqtt plugin, dzVents system, or the Plugin handler by Domoticz (see https://github.com/domoticz/domoticz/issues/4881 )

I am searching for a way to narrow down the cause.
User avatar
heggink
Posts: 972
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: How can I best debug dzVents?

Post by heggink »

Happy to try to help find the issue. I have had my share of issues with domoticz in the past (many different crashes from signal 6 to signal 11, scripts misbehaving for no apparent reason, the system getting blocked for 10 seconds not responding to triggers) so I know how frustrating it can be to find the cause.

Couple of things that would help me understand where you are coming from:
What debugging do you have switched on:
- domoticz (-loglevel normal,status,debug,error)?
- script level (logging = { level = domoticz.LOG_DEBUG, marker = "IETS" } and subsequent LOG_DEBUG logs)
What zigbee types of devices do you have? Since I don't experience your issues, maybe you have a device that I don;t have which causes dzvents to bork.

At some point, I had max debuggin on, leading to massive syslogs. Digging through those ultimately enabled me to find multiple culprits. I have helped a couple of other people find their issues so let's see.

Let me know. Feel free to PM me.

H
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: How can I best debug dzVents?

Post by EddyG »

Currently the logging is set to:
Domoticz -> logging is default in a docker container on a RPi 4 test system.
Zigbee2mqtt plugin -> logging is set to Verbose
dzVents -> logging is set to debug.

52 Zigbee devices of all kind of types.

The most problematic part is that errors (and crashes) occur random in time, with no relation to any device YET!

I cleared everything, now I have to wait to the first error to occur. :mrgreen:
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: How can I best debug dzVents?

Post by EddyG »

Up until now I found 1 strange thing in the logging, but that does not lead to an error.
This device https://www.zigbee2mqtt.io/devices/TS00 ... uya-ts0002 sends this zigbee message from zigbee2mqtt logging

Code: Select all

info  2021-08-14 12:20:26: MQTT publish: topic 'zigbee2mqtt/Slaapkamer', payload '{"brightness":203,"color":{"x":0.4599,"y":0.4106},"color_temp":300,"last_seen":"2021-08-14T12:20:26+02:00","linkquality":45,"state":"ON","state_l1":"OFF","state_l2":"ON"}'
But that device does not have brightness and color, very strange!!!
In the GUI of the zigbee2mqtt service it is a normal 2 pol. switch and the switch works normal.
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: How can I best debug dzVents?

Post by EddyG »

I got a little bit further.
I only get things working if I shutdown Domoticz and Zigbee2mqtt and disable Zigbee plugin hardware in Domoticz by phpLiteAdmin.
Then I start zigbee2mqtt and Domoticz, if everything is up then I enable Zigbee plugin in Domoticz.
Then things get running without a Domoticz crash, but a lot of device (not all) are not recognized any more by dzVents scripts, which give errors like the device is unknown.
When I actuate such a device in the GUI of Zigbee2mqtt then that device starts working again in Domoticz as it should.

So any ideas of where problem can be solved are welkom....
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: How can I best debug dzVents?

Post by EddyG »

After almost 5 days without any zigbee errors and crashes, it looks like the system is stable now.
What did I do to make it stable again?
A LOT!!! So it is difficult to point out what did the trick.
Most important is that I found out that not very device has all settings filled with the right value.
So I excluded and included a lot of those devices again.
After that all settings/properties were 'normalized' as that they have normal values instead of NULL or even empty.
Most problems were on battery powered devices.
What ever it caused it, I don't know, but it seems stabel now. :D

P.S. Still don't know where the dzVents error came from......
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: How can I best debug dzVents?

Post by EddyG »

Found 2 of the reasons:
1. Delete the file state.json in zigbee2mqtt/data dir and let it build fresh again.
2. https://github.com/stas-demydiuk/domoti ... issues/679
I hope the issue will be corrected soon!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest