Hello,
I am mostly stuck on the way to make a nice way to handle specific blinds on my home.
I have several bedroom and I want :
1- when sunrise > 7:00 am -> open blind at sunrise, otherwise open them at 7:00am
2- when sunset < 08:30 pm -> close bindd at sunset, otherwise closed them at 08:30pm.
Any nice way to handle that ?
Kind regards
Up and Down blinds with conditions.
Moderator: leecollings
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: Up and Down blinds with conditions.
try this:
first of all we will use dzVents which is much easy for me
LUA and dzVents have the time object that contain sunset and sunrise timers, we will use them
convert all timers to minutes since midnight
compare datas:
I did not test it yet... but it should works
first of all we will use dzVents which is much easy for me

LUA and dzVents have the time object that contain sunset and sunrise timers, we will use them
convert all timers to minutes since midnight
compare datas:
I did not test it yet... but it should works
Code: Select all
return {
on = {
devices = { 'TEST' },
timer = {
'at sunset',
'at 7:00',
'at sunrise',
'at 20:30',
}
execute = function(dz)
local minsSR = dz.time.sunriseInMinutes
local minsSS = dz.time.sunsetInMinutes
local minsMM = 420 -- 7:00 ==> ( 7*60)+00
local minsAN = 1230 -- 20:30 ==> (20*60)+30
if dz.trigger == 'at sunrise' and (minSR >= minsMM) then -- Script trigger at Sunset and Sunset after 7.00
-- Command to open blinds
elseif dz.trigger == 'at 7:00' and (minSR <= minsMM) then -- Script trigger at 7:00 and Sunset before 7.00
-- Command to open blinds
elseif dz.trigger == 'at sunset' and (minSS <= minsAN) then -- Script trigger at Sunset and Sunset after 7.00
-- Command to close blinds
elseif dz.trigger == 'at 20:30' and (minSS <= minsAN) then -- Script trigger at 7:00 and Sunset before 7.00
-- Command to close blinds
end
end
}
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
-
- Posts: 23
- Joined: Wednesday 28 March 2018 20:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.11307
- Location: Nederland
- Contact:
Re: Up and Down blinds with conditions.
Many paths lead to Rome... I like to put important steering values only once and on top.
The logic will work (I tested it on a lightbulb). However it doesn't work on my Curtain. It just won't open or close on the command
Hopefully, it will work for you...
Basically the code is called 4 times a day (like the example above), but the logic then is simpler as only action is taken if the actual time is between the cut off times and a time the sun is definitely above or below the horizon.
Should you get the actual blinds command for open/close to work, please let me know. I'll keep trying to find the right command as well.
The logic will work (I tested it on a lightbulb). However it doesn't work on my Curtain. It just won't open or close on the command
Hopefully, it will work for you...
Basically the code is called 4 times a day (like the example above), but the logic then is simpler as only action is taken if the actual time is between the cut off times and a time the sun is definitely above or below the horizon.
Should you get the actual blinds command for open/close to work, please let me know. I'll keep trying to find the right command as well.
Code: Select all
local DeviceName = "Curtain Kitchen"
local TimeOpen = "7:00" -- Curtain Open
local TimeClose = "20:30" -- Curtain Close
return {
on = { timer = {'at ' .. TimeOpen, 'at ' .. TimeClose, "at sunrise", "at sunset" }},
execute = function(domoticz)
if (domoticz.time.matchesRule('between ' .. TimeClose ..' and 23:59')) then
domoticz.log(domoticz.devices(DeviceName).state)
domoticz.devices(DeviceName).setState('Closed')
elseif (domoticz.time.matchesRule('between ' .. TimeOpen ..' and 12:00')) then
domoticz.devices(DeviceName).setState('Open')
end
end
}
HUE, Tradfri, Zwave, RFXCOM, rooted TOON, PS4
-
- Posts: 33
- Joined: Wednesday 24 October 2018 14:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Up and Down blinds with conditions.
Hello, sorry for my bad english.....
I have 2 Dummy switches for the two scenes rollos_groundfloor_down and rollos_upstairs_down. I will select that i can manual drive the rollos and automatically. Whe one of the switches is on the rollos of the scene should go down 15 minutes before sunset.... If the switches are out, i must drive the rollos manual. Is this possible to nake in the script?
Thanks
I have 2 Dummy switches for the two scenes rollos_groundfloor_down and rollos_upstairs_down. I will select that i can manual drive the rollos and automatically. Whe one of the switches is on the rollos of the scene should go down 15 minutes before sunset.... If the switches are out, i must drive the rollos manual. Is this possible to nake in the script?
Thanks
-
- Posts: 33
- Joined: Wednesday 24 October 2018 14:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Up and Down blinds with conditions.
without the times from the morning in the script, only from the evening.
thanks
thanks
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Up and Down blinds with conditions.
Not sure that I completely understand what you want but the script below triggers at 15 minutes before sunset and if the dummy switch for upstairs is On, the scene for the upstairs rollos is switched On and if the dummy switch for downstairs is On, the scene for the downstairs rolllos is switched On.
Hope this helps to get you started.
Code: Select all
-- rollos
return {
on = { timer = { "15 minutes before sunset" }},
logging = { level = domoticz.LOG_DEBUG, -- INFO, DEBUG or ERROR
marker = "rollos" },
execute = function(dz, item)
downSwitch = dz.devices("name of dummy that control groundfloor scene") -- Change to real name of switch
upSwitch = dz.devices("name of dummy that control upstairs scene") -- Change to real name of switch
if downSwitch.state == "On" then
dz.scenes("rollos_groundfloor_down").switchOn()
end
if upSwitch.state == "On" then
dz.scenes("rollos_upstairs_down").switchOn()
end
end
}
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
Who is online
Users browsing this forum: No registered users and 1 guest