Hi all
I have in rooms that are mainly controlled by PIR a need for more control.
I am trying to implement that spots dim to 50% light between 20:00 and 2300 and 30% between 23:00 and 5:30 .and 50% between 5:30 and 630
BUT the big issue is light switch need to be able to increase to 100% if pressed and overule dimming.
Light switches are "digital" and ON signal when pressed ,and otherwise off.
Is that even possible
to rookie to get it...
Moderator: leecollings
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: to rookie to get it...
Could be something likebozidar wrote: ↑Monday 18 March 2019 19:34 I have in rooms that are mainly controlled by PIR a need for more control.
I am trying to implement that spots dim to 50% light between 20:00 and 2300 and 30% between 23:00 and 5:30 .and 50% between 5:30 and 630
BUT the big issue is light switch need to be able to increase to 100% if pressed and overrule dimming.
Light switches are "digital" and ON signal when pressed ,and otherwise off.
Code: Select all
-- Time & Switch control
dim50Evening = "at 20:00"
dim30Night = "at 23:00"
dim50Morning = "at 5:30"
Off = "at 6:30"
return {
on = { timer = {
dim50Evening,
dim30Night,
dim50Morning,
Off,
},
devices = {
"your Switch",
},
},
logging = { level = domoticz.LOG_DEBUG,
marker = "Time & Switch control" },
data = { dimLevel = { initial = 50 }},
execute = function(dz,item)
local light = dz.devices("your dimmable light")
local function logWrite(str,level)
dz.log(tostring(str),level or dz.LOG_DEBUG)
end
if item.isTimer then
if dz.time.matchesRule(dim50Evening) or dz.time.matchesRule(dim50Morning) then
dz.data.dimLevel = 50
elseif dz.time.matchesRule(dim30Night) then
dz.data.dimLevel = 30
else
dz.data.dimLevel = 0
end
light.dimTo(dz.data.dimLevel)
else -- triggered by Switch
if item.state == "On" then -- Switch is On
dz.data.dimLevel = light.level -- store current Level
light.dimTo(100) -- full Power to the light
else
light.dimTo(dz.data.dimLevel) -- Restore to old dimLevel
end
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