Simple Lights on when dark script, Please help!

Moderator: leecollings

Post Reply
Tomtommert
Posts: 6
Joined: Tuesday 07 November 2017 16:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8631
Location: NL
Contact:

Simple Lights on when dark script, Please help!

Post 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
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

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

Post by dannybloe »

Have you checked the troubleshooting section in the dzVents documentation? Perhaps you can follow the steps mentioned there.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest