Page 1 of 1
dzVents crashing Domoticz ?
Posted: Thursday 17 August 2017 18:43
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 (14.22 KiB) Viewed 2113 times
Re: dzVents crashing Domoticz ?
Posted: Thursday 17 August 2017 19:22
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
Re: dzVents crashing Domoticz ?
Posted: Thursday 17 August 2017 19:43
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

Re: dzVents crashing Domoticz ?
Posted: Friday 18 August 2017 8:53
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.
Re: dzVents crashing Domoticz ?
Posted: Friday 18 August 2017 11:36
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.
Re: dzVents crashing Domoticz ?
Posted: Friday 18 August 2017 18:03
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.
Re: dzVents crashing Domoticz ?
Posted: Friday 18 August 2017 19:16
by dannybloe
The http call is probably the culprit here as it may take long or worse. Better not do that.
Re: dzVents crashing Domoticz ?
Posted: Saturday 19 August 2017 7:26
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...
Re: dzVents crashing Domoticz ?
Posted: Saturday 19 August 2017 16:29
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¶m=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

Re: dzVents crashing Domoticz ?
Posted: Saturday 19 August 2017 17:49
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.
Re: dzVents crashing Domoticz ?
Posted: Saturday 21 October 2017 19:20
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