Page 1 of 1

Error eventsystem

Posted: Friday 03 February 2023 13:48
by jacobsentertainment
Recently I have this reoccurring error, I noticed that it always hapens at a full hour, i wouldnt think it's a specific script then it would be more common and irregular.
Does any have this issue and even more interesting a solution?

Code: Select all

 2023-02-03 00:00:10.767 Error: EventSystem: Warning!, lua script /home/pi/domoticz/dzVents/runtime/dzVents.lua has been running for more than 10 seconds
2023-02-03 04:00:10.576 Error: EventSystem: Warning!, lua script /home/pi/domoticz/dzVents/runtime/dzVents.lua has been running for more than 10 seconds
2023-02-03 11:00:10.373 Error: EventSystem: Warning!, lua script /home/pi/domoticz/dzVents/runtime/dzVents.lua has been running for more than 10 seconds
2023-02-03 13:00:10.964 Error: EventSystem: Warning!, lua script /home/pi/domoticz/dzVents/runtime/dzVents.lua has been running for more than 10 seconds 

Re: Error eventsystem

Posted: Sunday 05 February 2023 22:46
by waltervl
Could be related to an event system script that runs something with an URL or OS command just when the hourly backup kicks in. Not really something to worry about but check your scripts and see if they use the asynchronous way of calling URL or OS commands.

Re: Error eventsystem

Posted: Monday 06 February 2023 0:48
by solarboy
I have a dzvents script that calls on another OS script that plays a long MP3 file. This will often throw this error. Also, like Walter says, during the hourly Domoticz backup.

Would be nice if we had the ability to schedule these backups as we see fit. I have now purposely made sure scripts never run on the hour for now.

Re: Error eventsystem

Posted: Monday 06 February 2023 11:57
by waltervl
solarboy wrote: Monday 06 February 2023 0:48 I have a dzvents script that calls on another OS script that plays a long MP3 file. This will often throw this error. Also, like Walter says, during the hourly Domoticz backup.

Would be nice if we had the ability to schedule these backups as we see fit. I have now purposely made sure scripts never run on the hour for now.
Did you use the DzVents Asynchronous shell command execution in that script? https://www.domoticz.com/wiki/DzVents:_ ... tion_3.1.0

Re: Error eventsystem

Posted: Monday 06 February 2023 22:18
by solarboy
I did, I've only ever used that way to call a system script.

Re: Error eventsystem

Posted: Wednesday 04 October 2023 11:24
by jacobsentertainment
I found out that this error is from my camera script.
Is there a easier way to get and send the snapshots?


I use

Code: Select all

return {
    on = { 
       devices = { 620, },
    },
	logging = {
		level = domoticz.LOG_DEBUG,
		marker = 'PIR-cam script',
	},
    execute = function(domoticz, device)
        local home = domoticz.devices(65)
        local Deurbel = domoticz.devices(146)
         
        --if(device.state == 'On' and home.state == 'Off') then
        if device.state == 'On' then
            --device.switchOff().afterSec(1).checkFirst().silent()
		    local teleTok   = '#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**#' --Not sharing this ;-)
		    local chatId    = '#*#*#*#*#*#*#'
            local snapFile  = '/home/pi/domoticz/scripts/camera_'
            local domoReqA  = 'http://192.168.178.144/snapshot.jpg?user=admin&pwd=8974'
            local domoReqB  = 'http://192.168.178.248/snapshot.jpg?user=admin&pwd=8974'
            local domoReqC  = 'http://192.168.178.247/snapshot.jpg?user=admin&pwd=8974'
            local camNameA  = 'Oprit'
            local camNameB  = 'Voordeur'
            local camNameC  = 'Achterdeur'
            os.execute('wget -O "'..snapFile..camNameA..'.jpg" "'..domoReqA..'"')
            os.execute('wget -O "'..snapFile..camNameB..'.jpg" "'..domoReqB..'"')
            os.execute('wget -O "'..snapFile..camNameC..'.jpg" "'..domoReqC..'"')
            os.execute('curl -s -X POST "https://api.telegram.org/bot'..teleTok..'/sendPhoto?chat_id='..chatId..'" -F photo="@'..snapFile..camNameA..'.jpg"')
            os.execute('curl -s -X POST "https://api.telegram.org/bot'..teleTok..'/sendPhoto?chat_id='..chatId..'" -F photo="@'..snapFile..camNameB..'.jpg"')
            os.execute('curl -s -X POST "https://api.telegram.org/bot'..teleTok..'/sendPhoto?chat_id='..chatId..'" -F photo="@'..snapFile..camNameC..'.jpg"')
            os.execute("rm " ..snapFile..camNameA..'.jpg')
            os.execute("rm " ..snapFile..camNameB..'.jpg')
            os.execute("rm " ..snapFile..camNameC..'.jpg')
            --domoticz.notify("Camera", 'Beweging gedetecteerd bij de ' ..device.name.. '', domoticz.PRIORITY_NORMAL,domoticz.SOUND_DEFAULT, "" , "telegram")
        end
    end
}

Re: Error eventsystem

Posted: Wednesday 04 October 2023 11:43
by waltervl
If the camera is available in domoticz you can send it with dzvents snapshot() to email.

Code: Select all

snapshot(cameraID(s) or camera Name(s)3.0.13,subject): Function. 
Sends email with a camera snapshots if email is configured and set for attachments in Domoticz. 
Send 1 or multiple camerIDs -names in ; separated string or array.
    dz.snapshot()                  -- defaults to id = 1, subject domoticz
    dz.snapshot(1,'dz')            -- subject dz
    dz.snapshot('1;2;3')           -- ; separated string
    dz.snapshot({1,4,7})           -- table
    dz.snapshot('test;test2')      -- ; separated string
    dz.snapshot({'test', 'test2'}) -- table
But if you are on telegram use domoticz.executeShellCommand('some shell command') instead of os.Execute('some shell command')

https://www.domoticz.com/wiki/DzVents:_ ... _execution