Hi guys,
I have a DZvents script, that runs well.
Basically my bathroom lights come on @ 90%when the detector picks you up, If the time is after 22:00 and before 06:00 the light comes on @20% so it is not too bright at night. and all the while it detects movement the lights stay on
However the issue I have is when the good lady in my life has a bath she asks Alexa, bathroom 20% all good however If she moves the lights then go back to 90%.
I need something that can pause the script for say an hour and the light will just stay at the level set
i.e. Alexa Bathtime on, script stops lights come on @20% and stay on until Alexa bathime off.
any help appreciated
cheers
Pause DZVents script [Solved]
Moderator: leecollings
-
alarm_guy1
- Posts: 132
- Joined: Tuesday 14 January 2014 0:03
- Target OS: Linux
- Domoticz version:
- Contact:
Pause DZVents script [Solved]
Last edited by alarm_guy1 on Wednesday 27 February 2019 4:28, edited 2 times in total.
- heggink
- Posts: 989
- Joined: Tuesday 08 September 2015 21:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 12451
- Location: NL
- Contact:
Re: Pause DZVents script
How about you only change the level if the light was off to begin with? So rather than reset on every movement, do it only if the light is off?
Verstuurd vanaf mijn SM-G955F met Tapatalk
Verstuurd vanaf mijn SM-G955F met Tapatalk
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
-
alarm_guy1
- Posts: 132
- Joined: Tuesday 14 January 2014 0:03
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Pause DZVents script
Thankyou for you reply, it is a difficult situation that cannot easily be rectified.
as we could go for a bath or shower at anytime or just go to wash and clean our teeth toilet etc. and there is no easy way for a system to know what we want to do, without extra sensors.
but I really require to just disable the DZvents
as we could go for a bath or shower at anytime or just go to wash and clean our teeth toilet etc. and there is no easy way for a system to know what we want to do, without extra sensors.
but I really require to just disable the DZvents
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Pause DZVents script
Probably easiest to create a dummy device in domoticz and change the Alexa action to this device. The dzVents script below will ensure that the lights will not change dimLevel when triggered by PIR while this dummy device is active.alarm_guy1 wrote: Monday 25 February 2019 20:16 Basically my bathroom lights come on @ 90%when the detector picks you up, If the time is after 22:00 and before 06:00 the light comes on @20% so it is not too bright at night. and all the while it detects movement the lights stay on
However the issue I have is when the good lady in my life has a bath she asks Alexa, bathroom 20% all good however If she moves the lights then go back to 90%.
I need something that can pause the script for say an hour and the light will just stay at the level set
i.e. Alexa Bathtime on, script stops lights come on @20% and stay on until Alexa bathime off.
any help appreciated
Code: Select all
local alexaDummyDevice = xxx -- <<<----- replace xxx by IDX of your alexaDummyDevice
return {
on = {
devices = {
"Bathroom MD Sensor",
alexaDummyDevice,
},
},
logging = {
level = domoticz.LOG_DEBUG,
marker = "Bathroom Motion"
},
execute = function(dz, item)
local dimmed = 20 -- dimlevel
local bright = 90 -- dimlevel
local shortVisit = 300 -- seconds
local longStay = 3600 -- seconds
local function logWrite(str,level)
dz.log(str,level or dz.LOG_DEBUG)
end
local LuxDevice = dz.devices(450) -- <<<--- replace xxx by IDX of your Lux device
local Lux = LuxDevice.lux
local Lights = dz.devices(440) -- <<<--- replace xxx by IDX of your Bathroom lights
local alexaActivated = dz.devices(alexaDummyDevice).active
logWrite(LuxDevice.name .. " ==>> Lux: " .. Lux )
logWrite(Lights.name .. " ==>> State: " .. Lights.state)
logWrite(item.name .. " ==>> State: " .. item.state)
if item.id == alexaDummyDevice then
Lights.cancelQueuedCommands()
if item.active then
Lights.dimTo(dimmed)
item.switchOff().afterSec(longStay)
else
Lights.switchOff()
end
elseif Lux < 100 and item.state == "On" and not ( alexaActivated ) then
Lights.cancelQueuedCommands()
if dz.time.matchesRule("at 23:00-06:00") then
Lights.dimTo(dimmed)
else
Lights.dimTo(bright)
end
elseif item.state == "Off" and Lights.state == "On" and not ( alexaActivated ) then
Lights.switchOff().afterSec(shortVisit)
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
-
alarm_guy1
- Posts: 132
- Joined: Tuesday 14 January 2014 0:03
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Pause DZVents script
Excellant, I will give this a try.
Many many thanks
Many many thanks
Who is online
Users browsing this forum: No registered users and 1 guest