Idea how to automatically turn on the lights when it gets dark

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

Moderator: leecollings

Post Reply
LastSamurai
Posts: 15
Joined: Wednesday 26 August 2015 1:00
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Idea how to automatically turn on the lights when it gets dark

Post 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?
pvm
Posts: 550
Joined: Tuesday 17 June 2014 22:14
Target OS: NAS (Synology & others)
Domoticz version: 4.10538
Location: NL
Contact:

Re: Idea how to automatically turn on the lights when it gets dark

Post 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.
Synology NAS, slave PI3, ZWave (Fibaro), Xiaomi zigbee devices, BTLE plant sensor, DzVents, Dashticz on tablet, Logitech Media Server
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Idea how to automatically turn on the lights when it gets dark

Post 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..
LastSamurai
Posts: 15
Joined: Wednesday 26 August 2015 1:00
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Idea how to automatically turn on the lights when it gets dark

Post by LastSamurai »

Thanks for your help. For now I am using a virtual switch to indicate when the script should to its work.
dutchdevil83
Posts: 130
Joined: Monday 31 October 2016 19:34
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Netherlands
Contact:

Re: Idea how to automatically turn on the lights when it gets dark

Post 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.
Hardware
1x Raspberry Pi
1x Razberry Z-Wave
1x RFXtrx433E
1x Toon
1x GoodWe Solarpanels
2x FGSD-002 Smoke Detector
1x FGBS-001 Binaire Sensor (RFID lezer)
7x FGMS-001 Motion Sensor
3x ZW089 Verzonken Deursensor
7x NC Wallplug
&lots of KaKu stuff
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Idea how to automatically turn on the lights when it gets dark

Post 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)
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Idea how to automatically turn on the lights when it gets dark

Post by Derik »

mm perhaps wait untill dzevent is build in domoticz..
new version should be work better then the v1
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
dutchdevil83
Posts: 130
Joined: Monday 31 October 2016 19:34
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Netherlands
Contact:

Re: Idea how to automatically turn on the lights when it gets dark

Post 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 :D
Hardware
1x Raspberry Pi
1x Razberry Z-Wave
1x RFXtrx433E
1x Toon
1x GoodWe Solarpanels
2x FGSD-002 Smoke Detector
1x FGBS-001 Binaire Sensor (RFID lezer)
7x FGMS-001 Motion Sensor
3x ZW089 Verzonken Deursensor
7x NC Wallplug
&lots of KaKu stuff
Misterik
Posts: 28
Joined: Sunday 11 December 2016 18:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Idea how to automatically turn on the lights when it gets dark

Post 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
is het donker.jpg (88.44 KiB) Viewed 5851 times
And another blocky to turn on lights. I currently looking into the feature to turn on the lights gradually
lampen aan.jpg
lampen aan.jpg (116.88 KiB) Viewed 5837 times
RPI-3 : RFLink + Zigbee2MQTT + Shelly + MySensors + Milight
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Idea how to automatically turn on the lights when it gets dark

Post by dannybloe »

Now, if someone creates a Blockly to dzVents converter, that would be awesome (and I don't think very hard to do).
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
JuanUil
Posts: 497
Joined: Friday 22 May 2015 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11083
Location: Asten NB Nederland
Contact:

Re: Idea how to automatically turn on the lights when it gets dark

Post 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
Your mind is like a parachute,
It only works when it is opened!

RPI4 several Fibaro, KaKu, Neocoolcam switches, Z-Wave, Zigbee2Mqtt, Ikea bulbs and remote, Zigbee temp nodes
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest