Page 1 of 1

Simple Lights on when dark script, Please help!

Posted: Tuesday 07 November 2017 16:28
by Tomtommert
Hi All,

I'm pretty new to scripting and LUA seems to be going a bit above my knowledge. This is why, when I saw the DZVents video I was really happy how simple it seemed. Before long I had my lights turning on when it got dark and off at a specific time. Somehow my script suddenly stopped working and I cant understand why. last week the Raspberry pi Domoticz is running on crashed and since then the DZvents scripts stopped working and I cant get them to work anymore. I'm hoping someone here can help me! The script probably is really easy to read for someone with a bit experience with scripting;

Code: Select all

return {
active = true, 
	on = {
		devices = {
        	'Schemerdummy'
        			},
		},

	execute = function(domoticz, device)
	
       	local Schemerlampen = domoticz.groups('Schemerlampen')
	local SchemerVar = domoticz.variables('SchemerVar')
		
		if (device.state == 'On' and Schemerlampen.state == 'Off' and SchemerVar.value == '0') then
		    	
		    	domoticz.log('XXXXXXXXXXXXXXX---LAMPEN GAAN AAN--XXXXXXXXXXXXXXXXXXXXXXX')
			domoticz.log(Schemerlampen.state)
			domoticz.log(device.state)
			domoticz.log(SchemerVar.value)
			domoticz.log('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
			
			Schemerlampen.switchOn().withinMin(10)
			SchemerVar.set(1)
        end
end
}   
So, the idea is when the device "Schemerdummy" turns on the script checks if Schemerdummy = on, Schemerlampen = off and SchemerVar = 0. If all this is the case the group Schemerlampen should turn on and the variable SchemerVar should become 1.

Hope someone here can help, I have been troubleshooting a lot but can figure out what i'm doing wrong.

Thanks a lot from this newbie :)

btw, I'm running on a Pi 3b, with Raspbian
Domoticz:
Version: 3.8631
Build Hash: 8b89f7f3
Compile Date: 2017-10-24 09:30:28
dzVents Version: 2.3.0

Re: Simple Lights on when dark script, Please help!

Posted: Friday 10 November 2017 8:35
by dannybloe
Have you checked the troubleshooting section in the dzVents documentation? Perhaps you can follow the steps mentioned there.