dzVents crashing Domoticz ?

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
jeanclic
Posts: 68
Joined: Saturday 28 January 2017 11:32
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France / Burgundy
Contact:

dzVents crashing Domoticz ?

Post by jeanclic »

Hello everyone,

I am facing an issue since I use dzVents (4 scripts so far, 20 in "standard" lua). From 2 to 4-5 times a day, I got this in the logs :

2017-08-17 07:22:13.708 Error: EventSystem: Warning!, lua script /home/pi/domoticz/scripts/dzVents/runtime/dzVents.lua has been running for more than 10 seconds
2017-08-17 07:22:13.927 (RFXtrx433E) Lighting 2 (Fenêtre Séjour 1)
2017-08-17 07:22:23.955 Error: EventSystem: Warning!, lua script /home/pi/domoticz/scripts/dzVents/runtime/dzVents.lua has been running for more than 10 seconds
2017-08-17 07:23:30.095 Error: RaspberryPi hardware (10) thread seems to have ended unexpectedly
2017-08-17 07:24:00.104 Error: Wunderground hardware (5) thread seems to have ended unexpectedly
2017-08-17 07:24:00.105 Error: RaspberryPi hardware (10) thread seems to have ended unexpectedly
2017-08-17 07:24:00.105 Error: OpenWeatherMap hardware (12) thread seems to have ended unexpectedly
2017-08-17 07:24:30.116 Error: EventSystem thread seems to have ended unexpectedly

Then I of course need to restart the domoticz service (I have a bash script doing that for me).

Did I missed something ? -> my Logging level is on "Error + forced messages".
As my signature say, I am on 3.8153, so my dzVents version is 2.2.0.

EDIT : see the Last Domoticz starts I have recorded :
2017-08-17 19_19_46-Domoticz.png
2017-08-17 19_19_46-Domoticz.png (14.22 KiB) Viewed 2032 times
Last edited by jeanclic on Thursday 17 August 2017 19:22, edited 1 time in total.
RPI3B (Domoticz 4.9700 + ~60 scripts) + RFXtrx433E (fw1020) + Z-Stick Gen5 + MySensors / RPI2B+ (RasPlex)
x1 Eth. wired tablet
x8 T/H Oregon / x1 T/H Bresser
x7 heaters / x2 QUBINO "Flush 1 relay"
x10 plugs / x15 contacts
x4 fibaro / x1 PIR
randytsuch
Posts: 90
Joined: Sunday 20 March 2016 18:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: LA, Ca USA
Contact:

Re: dzVents crashing Domoticz ?

Post by randytsuch »

Maybe try disabling the dzvents scripts and see if it still crashes?
Then enable them one by one, and determine which one is causing the problem.

Randy
jeanclic
Posts: 68
Joined: Saturday 28 January 2017 11:32
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France / Burgundy
Contact:

Re: dzVents crashing Domoticz ?

Post by jeanclic »

Thank you for the idea, I just disabled the last script I wrote. I will come back here in a few to update the status of my issue :)
RPI3B (Domoticz 4.9700 + ~60 scripts) + RFXtrx433E (fw1020) + Z-Stick Gen5 + MySensors / RPI2B+ (RasPlex)
x1 Eth. wired tablet
x8 T/H Oregon / x1 T/H Bresser
x7 heaters / x2 QUBINO "Flush 1 relay"
x10 plugs / x15 contacts
x4 fibaro / x1 PIR
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents crashing Domoticz ?

Post by dannybloe »

Not sure what you are doing but if a script is running for more than 10 seconds then there's surely something wrong with your script.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
tlpeter
Posts: 191
Joined: Wednesday 26 November 2014 18:43
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents crashing Domoticz ?

Post by tlpeter »

Not always as i have seen this happen sometimes while it normally worked fine.
But i have seen this some beta versions ago and did not occur lately.
jeanclic
Posts: 68
Joined: Saturday 28 January 2017 11:32
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France / Burgundy
Contact:

Re: dzVents crashing Domoticz ?

Post by jeanclic »

As promised, I come back here to say where I am : since I disabled my script Yesterday, no more Dz crash : my Dz is up for more than 24 hours now.

Here you find my script, in case of someone has time to look at it and point me some bugs out (sorry, the comments are in french, but I think its still understandable) :

Code: Select all

----------------------------------------------------------------------------------------------------------
-- Paramètres du script
----------------------------------------------------------------------------------------------------------
local Debug = domoticz.LOG_FORCE    -- domoticz.LOG_DEBUG = Activation des infos dans le log pour débug. domoticz.LOG_FORCE pour normal
local SecPanel = 'Activation Alarme'
local devicesToCheck = {
    ['Fenêtre Ch.Bleue'] = 2,
    ['Fenêtre Ch.Verte'] = 2,
    ['Fenêtre Ch.Etage'] = 2,
    ['Fenêtre Toilettes']= 2,
    ['Fenêtre Séjour 1'] = 2,
    ['Fenêtre Séjour 2']= 2,
    ['Fenêtre Bureau'] = 2,
    ['Fenêtre Salle de Bain'] = 2,
    ['Fenêtre Cuisine 1'] = 2,
    ['Fenêtre Cuisine 2'] = 2,
    ['Porte Entrée'] = 1,
    ['Porte Escalier'] = 2,
    --['PIR_Rdc'] = 2
}
----------------------------------------------------------------------------------------------------------
-- Traitement
----------------------------------------------------------------------------------------------------------
local function file()
    local path = debug.getinfo(1,'S').short_src
    while string.find(path, '/') do path = string.sub(path, string.find(path, '/')+1) end
    return tostring(string.sub(path, 1, string.len(path)-4))
end
local function checkSecurity(oDz, oDevice, iLevel)
    if devicesToCheck[oDevice.name] == iLevel then
        if oDevice.state == 'Open' or oDevice.state == 'On' then
            oDz.notify('Alarme intrusion', 'La maison est en mode '..oDz.security..' et '..oDevice.name..' est '..oDevice.state..'. Il y a probablement une intrusion.', oDz.PRIORITY_EMERGENCY)
            oDz.log(oDevice.name..' '..oDevice.state, oDz.LOG_DEBUG)
        end
    end
end
return {
	active = true,
	on = {
	    devices = {
    	    'Fenêtre*',
    	    'Porte*',
    	    --'PIR_Rdc'
		}
	},
	logging = {
        level = Debug,
        marker = '['..file()..']'
    },
	execute = function(domoticz, device)
	    iSecOnDelay = tonumber(domoticz.helpers.os_capture("curl -s 'http://127.0.0.1:8080/json.htm?type=settings' | jq -r '.SecOnDelay'"))
	    if device ~= nil then
            if domoticz.devices(SecPanel).lastUpdate.secondsAgo > iSecOnDelay then
                if domoticz.security == domoticz.SECURITY_DISARMED then
        	        domoticz.log('Statut Alarme : "Désarmée" depuis le '..domoticz.devices(SecPanel).lastUpdate.raw, domoticz.LOG_DEBUG)
                elseif  domoticz.security == domoticz.SECURITY_ARMEDHOME then
         	        domoticz.log('Statut Alarme : "Armement en présence" depuis le '..domoticz.devices(SecPanel).lastUpdate.raw, domoticz.LOG_DEBUG)
                    checkSecurity(domoticz, device, 1)
                elseif  domoticz.security == domoticz.SECURITY_ARMEDAWAY then
         	        domoticz.log('Statut Alarme : "Armement en absence" depuis le '..domoticz.devices(SecPanel).lastUpdate.raw, domoticz.LOG_DEBUG)
                    checkSecurity(domoticz, device, 2)
                end
            end
        else
            domoticz.log('Ce script doit être appelé uniquement sur "devices"', domoticz.LOG_ERROR)
        end
	end
}
I created the "file()" function yesterday, and I just reactivated this script to see if with this function, I can spare the filename calculation at each call of this script.
RPI3B (Domoticz 4.9700 + ~60 scripts) + RFXtrx433E (fw1020) + Z-Stick Gen5 + MySensors / RPI2B+ (RasPlex)
x1 Eth. wired tablet
x8 T/H Oregon / x1 T/H Bresser
x7 heaters / x2 QUBINO "Flush 1 relay"
x10 plugs / x15 contacts
x4 fibaro / x1 PIR
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents crashing Domoticz ?

Post by dannybloe »

The http call is probably the culprit here as it may take long or worse. Better not do that.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
jeanclic
Posts: 68
Joined: Saturday 28 January 2017 11:32
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France / Burgundy
Contact:

Re: dzVents crashing Domoticz ?

Post by jeanclic »

Yes I think that too but I did not find any alternative to that... I don't think there is a 'domoticz.settings(«SecOnDelay»).value' available in dzVents... am I right ?
The obvious alternative is to put some parameter inside this script but I don't like dobbling parameters if I can avoid it...
RPI3B (Domoticz 4.9700 + ~60 scripts) + RFXtrx433E (fw1020) + Z-Stick Gen5 + MySensors / RPI2B+ (RasPlex)
x1 Eth. wired tablet
x8 T/H Oregon / x1 T/H Bresser
x7 heaters / x2 QUBINO "Flush 1 relay"
x10 plugs / x15 contacts
x4 fibaro / x1 PIR
jeanclic
Posts: 68
Joined: Saturday 28 January 2017 11:32
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France / Burgundy
Contact:

Re: dzVents crashing Domoticz ?

Post by jeanclic »

So, defined a variable named "SecOnDelay", and I update it one time per day via a bash script containing those lines :

Code: Select all

SecDelay=`curl -s "http://127.0.0.1:8080/json.htm?type=settings" | jq -r '.SecOnDelay'`
curl -s "http://127.0.0.1:8080/json.htm?type=command&param=updateuservariable&vname=SecOnDelay&vtype=0&vvalue=$SecDelay" > /dev/null
And I changed my dzVents scripts by this one :

Code: Select all

----------------------------------------------------------------------------------------------------------
-- Paramètres du script
----------------------------------------------------------------------------------------------------------
local Debug = domoticz.LOG_FORCE    -- domoticz.LOG_DEBUG = Activation des infos dans le log pour débug. domoticz.LOG_FORCE pour normal
local SecPanel = 'Activation Alarme'
local devicesToCheck = {
    ['Fenêtre Ch.Bleue'] = 2,
    ['Fenêtre Ch.Verte'] = 2,
    ['Fenêtre Ch.Etage'] = 2,
    ['Fenêtre Toilettes']= 2,
    ['Fenêtre Séjour 1'] = 2,
    ['Fenêtre Séjour 2']= 2,
    ['Fenêtre Bureau'] = 2,
    ['Fenêtre Salle de Bain'] = 2,
    ['Fenêtre Cuisine 1'] = 2,
    ['Fenêtre Cuisine 2'] = 2,
    ['Porte Entrée'] = 1,
    ['Porte Escalier'] = 2,
    --['PIR_Rdc'] = 2
}
----------------------------------------------------------------------------------------------------------
-- Traitement
----------------------------------------------------------------------------------------------------------
local function file()
    local path = debug.getinfo(1,'S').short_src
    while string.find(path, '/') do path = string.sub(path, string.find(path, '/')+1) end
    return tostring(string.sub(path, 1, string.len(path)-4))
end
local function checkSecurity(oDz, oDevice, iLevel)
    if devicesToCheck[oDevice.name] == iLevel then
        if oDevice.state == 'Open' or oDevice.state == 'On' then
            oDz.notify('Alarme intrusion', 'La maison est en mode '..oDz.security..' et '..oDevice.name..' est '..oDevice.state..'. Il y a probablement une intrusion.', oDz.PRIORITY_EMERGENCY)
            oDz.log(oDevice.name..' '..oDevice.state, oDz.LOG_DEBUG)
        end
    end
end
return {
	active = true,
	on = {
	    devices = {
    	    'Fenêtre*',
    	    'Porte*',
    	    --'PIR_Rdc'
		}
	},
	logging = {
        level = Debug,
        marker = '['..file()..']'
    },
	execute = function(domoticz, device)
	    domoticz.log('Délai avant activation alarme : '..domoticz.variables('SecOnDelay').value..'s', domoticz.LOG_DEBUG)
	    if device ~= nil then
            if domoticz.devices(SecPanel).lastUpdate.secondsAgo > domoticz.variables('SecOnDelay').value then
                if domoticz.security == domoticz.SECURITY_DISARMED then
        	        domoticz.log('Statut Alarme : "Désarmée" depuis le '..domoticz.devices(SecPanel).lastUpdate.raw, domoticz.LOG_DEBUG)
                elseif  domoticz.security == domoticz.SECURITY_ARMEDHOME then
         	        domoticz.log('Statut Alarme : "Armement en présence" depuis le '..domoticz.devices(SecPanel).lastUpdate.raw, domoticz.LOG_DEBUG)
                    checkSecurity(domoticz, device, 1)
                elseif  domoticz.security == domoticz.SECURITY_ARMEDAWAY then
         	        domoticz.log('Statut Alarme : "Armement en absence" depuis le '..domoticz.devices(SecPanel).lastUpdate.raw, domoticz.LOG_DEBUG)
                    checkSecurity(domoticz, device, 2)
                end
            end
        else
            domoticz.log('Ce script doit être appelé uniquement sur "devices"', domoticz.LOG_ERROR)
        end
	end
}
I will see in the next days if its crashing again :roll:
RPI3B (Domoticz 4.9700 + ~60 scripts) + RFXtrx433E (fw1020) + Z-Stick Gen5 + MySensors / RPI2B+ (RasPlex)
x1 Eth. wired tablet
x8 T/H Oregon / x1 T/H Bresser
x7 heaters / x2 QUBINO "Flush 1 relay"
x10 plugs / x15 contacts
x4 fibaro / x1 PIR
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents crashing Domoticz ?

Post by dannybloe »

You can also create a global persistent variable in global_data and create a script that only runs once a day and only does the request if the var is empty. Quite simple with dzVents.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
mvroosmalen
Posts: 23
Joined: Saturday 03 December 2016 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dzVents crashing Domoticz ?

Post by mvroosmalen »

Hi,

I think its a general problem as I was playing with DzVents and noted the same problem:
Error: EventSystem: Warning!, lua script ...domoticz/scripts/dzVents/runtime/dzVents.lua has been running for more than 10 seconds

Removing all dzVents scripts doesn't resolve this issue. It seems that this script is embedded after being used?? as
dzVents: All based event fired, keeps being logged..

Is there a solution to disable dzVents to check if this indeed related to the system crash?

Thanks,

Mark
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest