Page 1 of 1

Event system not working properly

Posted: Tuesday 07 July 2020 19:24
by EddyG
I have a Zigbee device, which works properly, but when activated does not fire the event system.
This is a script which is not fired.

Code: Select all

return {
    on = {
        devices = {
            'Afzuigkap'
        }
    },
    execute = function(domoticz, device)
        domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
    end
}
When I click the widget in Domoticz the Bulb goes On and Off as expected.
The logging of Domoticz only shows

Code: Select all

2020-07-07 19:19:58.130 Status: User: Admin initiated a switch command (1011/Afzuigkap/On)
But the script is not triggered. I probably overlooking something.
Previous the device was a Zwave device, which had the same name but now rename to 'Afzuigkap OLD' and set as 'Unused'
I never had a problem with the Zwave device, at least I did not noticed it.
I checked it with an additional RFXCOM device, and that worked as expected. Script was 'fired'
Why does the event system not trigger the script?

Re: Event system not working properly

Posted: Tuesday 07 July 2020 22:06
by waaren
EddyG wrote: Tuesday 07 July 2020 19:24 I have a Zigbee device, which works properly, but when activated does not fire the event system.
Why does the event system not trigger the script?
Do you see the script being saved when modified in the internal script editor?
Can you check with a Blockly if that does fire?
If that works as expected then please switch on debug in settings for dzVents.
What is the hardware module,-type and subtype for this device?

Re: Event system not working properly

Posted: Tuesday 07 July 2020 22:33
by EddyG
I edit my scripts in nano and put them in the dzVents script directory.
The (sample) scripts works with other devices, even with an other Zigbee device.
I used debug mode but with this device, the only line is the "Admin initiated..." line.
Hardware is Zigbee2Mqtt, device has type 244 with subtype 73
I will look into Blocky.

Re: Event system not working properly

Posted: Tuesday 07 July 2020 22:44
by EddyG
It gets stranger. After I made a blocky (not completely correct) and saved it.
That blocky did not work, but my scripts did work, both the sample script as my original script.
It still works after I deleted the blocky.
To be continued (tomorrow) with the rest of my zigbee devices.

Re: Event system not working properly

Posted: Wednesday 08 July 2020 8:54
by EddyG
Today exactly the same.
By logrotate Domoticz is reloaded every day.
Today that device did not create events when I clicked on it.
Made a working Blocky and the event was fired, as it should.
The original script, my test script and Blocky, all where fired.
So wait until tomorrow.

Re: Event system not working properly

Posted: Wednesday 08 July 2020 10:14
by EddyG
I tested a lot more.
But at some point the problem comes back.
The zigbee device will not trigger the event system.
In debug mode it only logs.

Code: Select all

2020-07-08 10:12:15.783 Status: User: Admin initiated a switch command (1009/Keukenkastspotjes/Off)
Funny part is that the device 'Afzuigkap' functions normally now (but for how long?).

Re: Event system not working properly

Posted: Wednesday 08 July 2020 11:41
by waaren
EddyG wrote: Wednesday 08 July 2020 10:14 But at some point the problem comes back.
I guess you will need to switch on full debug logging in domoticz and dzVents. Hopefully that will show enough to pinpoint this issue.

Re: Event system not working properly

Posted: Wednesday 08 July 2020 12:19
by EddyG
I now did, everything that is possible to log is there.
Once I clicked the device Domoticz came to an halt.
This is the last logging of that 1 click.

Code: Select all

2020-07-08 12:00:52.151 [72d25220] Debug: web: Host:192.168.2.48 Uri;/json.htm?type=command&param=switchlight&idx=1009&switchcmd=Off&level=0&passcode=
2020-07-08 12:00:52.151 [72d25220] Debug: WEBS GetJSon :switchlight :/json.htm?type=command&param=switchlight&idx=1009&switchcmd=Off&level=0&passcode=
2020-07-08 12:00:52.151 [72d25220] Debug: WEBS switchlight idx:1009 switchcmd:Off level:-1
2020-07-08 12:00:52.152 [72d25220] Debug: MAIN SwitchLight idx:1009 cmd:Off lvl:-1
2020-07-08 12:00:52.152 [72d25220] Debug: MAIN SwitchLightInt : switchcmd:Off level:-1 HWid:33 sd:33 0xccccccfffeafe310_switch 97 244 73 0
2020-07-08 12:00:52.153 [72d25220] Debug: MAIN SwitchLightInt : switchcmd=="On" || level < 0, new level:0
2020-07-08 12:00:55.730 [72d25220] Debug: web: Host:192.168.2.48 Uri;/json.htm?type=command&param=getlog&lastlogtime=1594202449&loglevel=268435455
2020-07-08 12:00:55.731 [72d25220] Debug: WEBS GetJSon :getlog :/json.htm?type=command&param=getlog&lastlogtime=1594202449&loglevel=268435455
2020-07-08 12:00:56.280 [72d25220] Debug: web: Host:192.168.2.48 Uri;/json.htm?type=command&param=switchlight&idx=1009&switchcmd=Off&level=0&passcode=
2020-07-08 12:00:56.280 [72d25220] Debug: WEBS GetJSon :switchlight :/json.htm?type=command&param=switchlight&idx=1009&switchcmd=Off&level=0&passcode=
2020-07-08 12:00:56.280 [72d25220] Debug: WEBS switchlight idx:1009 switchcmd:Off level:-1
2020-07-08 12:00:56.280 [72d25220] Debug: MAIN SwitchLight idx:1009 cmd:Off lvl:-1
2020-07-08 12:00:56.281 [72d25220] Debug: MAIN SwitchLightInt : switchcmd:Off level:-1 HWid:33 sd:33 0xccccccfffeafe310_switch 97 244 73 0
2020-07-08 12:00:56.281 [72d25220] Debug: MAIN SwitchLightInt : switchcmd=="On" || level < 0, new level:0
2020-07-08 12:01:00.545 [5f4fb220] Debug: SQLH AddTask: Request to add task: idx=46199590393920320, DelayTime=0.000000, Command='', Level=1832954368, Color='{INVALID}', RelatedEvent=''
2020-07-08 12:01:00.558 [752fe220] Debug: SQLH: Do Task ItemType:6 Cmd: Value:https://data.buienradar.nl/1.1/feed/json
2020-07-08 12:01:00.758 [72d25220] Debug: web: Host:192.168.2.48 Uri;/json.htm?type=command&param=getlog&lastlogtime=1594202455&loglevel=268435455
2020-07-08 12:01:00.758 [72d25220] Debug: WEBS GetJSon :getlog :/json.htm?type=command&param=getlog&lastlogtime=1594202455&loglevel=268435455
I see a Color='{INVALID}', where might that come from or is it normal? The device is a Ikea TRADFRI control outlet (zigbee). In Domoticz a Type: Light/Switch, Switch, On/Off

Re: Event system not working properly

Posted: Wednesday 08 July 2020 13:14
by waaren
EddyG wrote: Wednesday 08 July 2020 12:19 I now did, everything that is possible to log is there.
Once I clicked the device Domoticz came to an halt.

I see a Color='{INVALID}', where might that come from or is it normal? The device is a Ikea TRADFRI control outlet (zigbee). In Domoticz a Type: Light/Switch, Switch, On/Off
seems similar to this topic

Re: Event system not working properly

Posted: Wednesday 08 July 2020 16:01
by EddyG
After a lot of testing is seems that the stop /start of Domoticz (because of the debug logging) did the trick.
At this moment I have no issues.
I see in the Process Usage widget that Domoticz is slowly eating memory, not as much as with the previous python problem, but still in a week more than 10Mb. Not much but it should not be.
Lets wait and see what happens in the coming days.

My problem is not the same as in the other topic. The event system still works but some device don't trigger the event system anymore.