Page 1 of 1
Idea how to automatically turn on the lights when it gets dark
Posted: Sunday 18 June 2017 9:24
by LastSamurai
Hi, I am using dzVents (great piece of software!) with my domoticz controller to control a set of MySensors devices. I have several RGBW lights in my bed room and a light sensors.
Currently I can only manually (or via an amazon echo) control these lights. As I am using them nearly every day once it gets dark (which is already before sunset!) I really want to automate this.
The idea would be to automatically turn on the lights based on a certain light level send from the sensor (even better version would be to do it in smaller steps). The problem though is that at a certain point I want to go to sleep and the lights have to stay off then. Any idea how to (logically) structure this so that I can create a script for this?
Re: Idea how to automatically turn on the lights when it gets dark
Posted: Sunday 18 June 2017 9:40
by pvm
One option could be to add a virtual switch 'lights -off' in a blockly statement. You can switch this when you go to sleep and switch it back when it is light again or at timer st 10.00.
Re: Idea how to automatically turn on the lights when it gets dark
Posted: Monday 19 June 2017 11:49
by freijn
Not sure if you know this but:
I am using 10 min after sundown as a switch on. It adjusts perfectly during the summer.
Only disadvantage on a dark clouds day, it could be a few min earlier..
Re: Idea how to automatically turn on the lights when it gets dark
Posted: Thursday 29 June 2017 18:28
by LastSamurai
Thanks for your help. For now I am using a virtual switch to indicate when the script should to its work.
Re: Idea how to automatically turn on the lights when it gets dark
Posted: Thursday 29 June 2017 19:20
by dutchdevil83
I use a virtual LUX sensor created with the Wunderground plugin. Then i wrote a script that looks at the outside light (when below 2000lux then) also look at te time (when it`s >16 hour) and look at a variable (when lightonceaday = 0) when all of this is true then turn on the lights (and make the uservariable lightonceaday = 1 (to prevent switching the light more then once a day). Don`t forget the reset this uservariable to 0 on 3 oclock in the midday or something like that.
Re: Idea how to automatically turn on the lights when it gets dark
Posted: Thursday 29 June 2017 20:07
by EdwinK
Could you post the script? For the outside lamp I now use the 'on before sunset' and 'off at sunrise' in the device settings, but if it visibility gets low I want it to turn on as well.
(Im not a scripter, so if it involves heavy scripting, then I need to forget it)
Re: Idea how to automatically turn on the lights when it gets dark
Posted: Thursday 29 June 2017 20:51
by Derik
mm perhaps wait untill dzevent is build in domoticz..
new version should be work better then the v1
Re: Idea how to automatically turn on the lights when it gets dark
Posted: Friday 30 June 2017 20:16
by dutchdevil83
EdKo66 wrote:Could you post the script? For the outside lamp I now use the 'on before sunset' and 'off at sunrise' in the device settings, but if it visibility gets low I want it to turn on as well.
(Im not a scripter, so if it involves heavy scripting, then I need to forget it)
Do you have already a outside lux sensor created from the "weather hardware" ? It involves some scripting skills and some trial and error to get things functioning the way you want sometimes but that`s way i learned it also

Re: Idea how to automatically turn on the lights when it gets dark
Posted: Thursday 06 July 2017 21:07
by Misterik
I am using the following blocky /lua-scripts:
To determine the lux value with the weatherunderground api
https://www.domoticz.com/wiki/Real-time ... _sensor.... I am also working on a mysensor project to measure my own lux-value, because some rooms with no windows or just one window need light before rooms with a lot of windows.
The following to determine if it is already dark

- is het donker.jpg (88.44 KiB) Viewed 5853 times
And another blocky to turn on lights. I currently looking into the feature to turn on the lights gradually

- lampen aan.jpg (116.88 KiB) Viewed 5839 times
Re: Idea how to automatically turn on the lights when it gets dark
Posted: Friday 07 July 2017 9:26
by dannybloe
Now, if someone creates a Blockly to dzVents converter, that would be awesome (and I don't think very hard to do).
Re: Idea how to automatically turn on the lights when it gets dark
Posted: Friday 07 July 2017 13:46
by JuanUil
Hi There,
I have made a LUA script to do exactly what you want.
viewtopic.php?f=38&t=14237
good luck and have fun with it.
Jan