i started using dzvents and it is really nice once you get the logic in your head, i created a script which would turn on my bathroom lights (Group badkamer boven = the name in the script) when my motion sensor(PIR badkamer boven = the name in the script) is triggered or when there is water in the shower(Water douche boven = the name in the script). it works well but i had something in my blockly which i was using before where i could check the lux value of my motionsensor and act upon it, also i had time values for example before 23:00 set light to 100% after 23:00 set light at 40% but only if the shower is off. and this all if the lux value was below 30
while i think dzvents would be a much better solution then my 4 combined blockly scripts which stopped magically working i can not seem to find out from the documentation or the awesome getting started video how to get the above functions in my script. so if someone can help me, please... also, do not laugh at my basic level of dzvents plz XD
--[[ ShowerTest.lua for
]]--
return {
on = {
devices = {
"Water douche boven",
"PIR badkamer boven",
"licht tk was aan",
}
},
execute = function(dz, device)
local luxLevel = dz.devices("motion sensor").lux
local shower = dz.devices("water douche boven").state
local badkamerLicht = dz.devices("Group badkamer boven")
local lightStrength = 100
if (dz.time.matchesRule("at 23:00-23:59") or dz.time.matchesRule("at 00:00-08:00")) and shower.state == "Off" and luxLevel < 30 then
lightStrength = 40
end
if(device.state == "On") then
badkamerLicht.dimTo(lightStrength)
else
badkamerLicht.switchOff()
end
end
}
wow, thanks again!
this is an amazing start, now i just have to figure out how to let the lights stay on for two minutes or something like that when motion was triggered because that hue motion sensor is really sensitive, when you stand still it immediately stops saying that there is motion and flickering lights are a bit anoying
but this is really amazing, i hope you did not only help me but also others who are searching for something similar
snellejellep wrote: ↑Thursday 07 June 2018 8:10
.. now i just have to figure out how to let the lights stay on for two minutes or something like that when motion was triggered because that hue motion sensor is really sensitive, when you stand still it immediately stops saying that there is motion and flickering lights are a bit anoying
but this is really amazing, i hope you did not only help me but also others who are searching for something similar..
To give an idea how to solve this; added a minimum of 2 minutes between switch "On" and - "Off"
snellejellep wrote: ↑Thursday 07 June 2018 8:10
.. now i just have to figure out how to let the lights stay on for two minutes or something like that when motion was triggered because that hue motion sensor is really sensitive, when you stand still it immediately stops saying that there is motion and flickering lights are a bit anoying
but this is really amazing, i hope you did not only help me but also others who are searching for something similar..
To give an idea how to solve this; added a minimum of 2 minutes between switch "On" and - "Off"
snellejellep wrote: ↑Thursday 07 June 2018 8:10
.. now i just have to figure out how to let the lights stay on for two minutes or something like that when motion was triggered because that hue motion sensor is really sensitive, when you stand still it immediately stops saying that there is motion and flickering lights are a bit anoying
but this is really amazing, i hope you did not only help me but also others who are searching for something similar..
To give an idea how to solve this; added a minimum of 2 minutes between switch "On" and - "Off"
elseif badkamerLicht.lastUpdate.minutesAgo > 2 then
gets executed at some time > 2 minutes after the light is no longer on?
I ran in to that problem myself so i added a five minute timer as an extra trigger. So it gets triggered every five minutes to check if the lights still need to be on
ah, thanks. I was wondering if I had overlooked something I have a separate, generic script called "Auto Off" that gets executed once a minute to check for devices that need to be switched off. This way I can keep the scripts to switch things on simple.
In the off event for the PIR you could put domoticz.devices('bathroom lights name').switchOff().afterMin(2) which would switch off lights two minutes after PIR has reported no motion. You then need to put domoticz.devices('bathroom lights name').cancelQueuedCommands() in PIR On event otherwise it will switch off no matter if PIR has detected motion or not.
snellejellep wrote:@bozidar, i use a xiaomi gateway with water sensor, those sensors are really small and fit in the thingy the water flows to (drain?)
Brilliant idea, thnx! Nice solution for switching ventilation
Synology NAS, slave PI3, ZWave (Fibaro), Xiaomi zigbee devices, BTLE plant sensor, DzVents, Dashticz on tablet, Logitech Media Server