I know I've seen such a script here somewhere, but searching for it doesn't find any.
What I need to do is when the LUX is below a set level (500 for example) it needs to turn on the outside lights. When the level is above the set level then turn it off again.
(The 500 is arbitrary, it could well be another level that I need, think twilight or dusk).
Lights on when LUX <=500 else off
Moderator: leecollings
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Lights on when LUX <=500 else off
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Lights on when LUX <=500 else off
In its most simple formEdwinK wrote: Sunday 30 December 2018 15:32 I know I've seen such a script here somewhere, but searching for it doesn't find any.
What I need to do is when the LUX is below a set level (500 for example) it needs to turn on the outside lights. When the level is above the set level then turn it off again.
(The 500 is arbitrary, it could well be another level that I need, think twilight or dusk).
Code: Select all
-- outside lights
return {
on = { timer = { "every 15 minutes" } },
execute = function(dz)
lowerLux = 400
upperLux = 500
currentLux = dz.devices("lux device name").lux
outsideLight = dz.devices("outside light name")
if currentLux < lowerLux then
outsideLight.switchOn().checkFirst()
elseif currentLux > upperLux then
outsideLight.switchOff().checkFirst()
end
end
}
Last edited by waaren on Sunday 30 December 2018 17:35, edited 1 time in total.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Lights on when LUX <=500 else off
Thanks. I like the most simple form's
. Just I have several switches. One called 'Lamp - Berging' and the others 'Buiten - 1' and 'Buiten - 2' Should have said that before 
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Lights on when LUX <=500 else off
If you always want to switch them together then probably easier to put them in a group. Please send me a PM if you want to discuss furtherEdwinK wrote: Sunday 30 December 2018 16:07 Thanks. I like the most simple form's. Just I have several switches. One called 'Lamp - Berging' and the others 'Buiten - 1' and 'Buiten - 2' Should have said that before
![]()
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Lights on when LUX <=500 else off
Let's see if I can get that to work
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- havnegata
- Posts: 114
- Joined: Wednesday 10 September 2014 11:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10162
- Location: Norway
- Contact:
Re: Lights on when LUX <=500 else off
Please, @waaren, continue to share your knowledge here in the forum and not by PM's. That way lots of people can learn, and I for sure have learned a lot from you!
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Lights on when LUX <=500 else off
I will but sometimes the process of getting to a result require a lot of communication that is not very interesting for many.havnegata wrote: Sunday 30 December 2018 17:32 Please, @waaren, continue to share your knowledge here in the forum and not by PM's. That way lots of people can learn, and I for sure have learned a lot from you!
I always ask to share the end-result when it can be of any use to others.
and.. thx for the compliment.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Lights on when LUX <=500 else off
O.. I will put the end result
Now it looks real simple.
Code: Select all
-- outside lights
return {
on = { timer = { "every 15 minutes" } },
execute = function(dz)
lowerLux = 400
upperLux = 500
currentLux = dz.devices("LUX").lux
outsideLights = dz.groups("Buitenlampen") --This should be a group, not a scene!!
if currentLux < lowerLux then
outsideLights.switchOn().checkFirst()
elseif currentLux > upperLux then
outsideLights.switchOff().checkFirst()
end
end
}Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Who is online
Users browsing this forum: No registered users and 1 guest