dear forum users,
i have a wish and i do not know how to realize it, i have a button connected to domoticz which i want to use as a doorbell, when the doorbell is pressed i want some lights to flash, but is there a possibility to store the state of the light, activate a doorbell scene and after the scene restore the state off the lights.
for as far as i know this should be possible in dzvents but i do not know how to do that.
i hope someone can help me, thanks in advance!
doorbell script
Moderators: leecollings, remb0
-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
doorbell script
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: doorbell script
@snellejellep, Should be possible but some questions:snellejellep wrote: ↑Monday 10 September 2018 21:20 i have a wish and i do not know how to realize it, i have a button connected to domoticz which i want to use as a doorbell, when the doorbell is pressed i want some lights to flash, but is there a possibility to store the state of the light, activate a doorbell scene and after the scene restore the state off the lights.
- are these standard on/off, -dimlights or rgbw type of lights
- howto "flash" these lights? Simple on/off or something else ?
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
-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
Re: doorbell script
I use philips hue lights, some are rgb, some just white, i tought about just flashing the white ones and letting the rgb ones flash red, the color change is what makes it difficult i think.waaren wrote:@snellejellep, Should be possible but some questions:snellejellep wrote: ↑Monday 10 September 2018 21:20 i have a wish and i do not know how to realize it, i have a button connected to domoticz which i want to use as a doorbell, when the doorbell is pressed i want some lights to flash, but is there a possibility to store the state of the light, activate a doorbell scene and after the scene restore the state off the lights.
- are these standard on/off, -dimlights or rgbw type of lights
- howto "flash" these lights? Simple on/off or something else ?
Also i wanted to use the data from my motion sensors to let the lights flash only in the rooms people are
But first wanted to start with just the flashing
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
- HansieNL
- Posts: 964
- Joined: Monday 28 September 2015 15:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: doorbell script
Maybe you can take a look at the HUE API. https://www.developers.meethue.com/docu ... ng-started
With a curl command a lot is possible:
With a curl command a lot is possible:
Code: Select all
curl -H "Accept: application/json" -X PUT --data '{"alert":"select"}' http://<hue-bridge-ip>/api/<hue-username>/lights/4/state
Blah blah blah
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: doorbell script
Maybe this example script will help in what you want to achieve. Another line of approach could be to trigger an IFTTT applet from this dzVents script.snellejellep wrote: ↑Monday 10 September 2018 21:40I use philips hue lights, some are rgb, some just white, i tought about just flashing the white ones and letting the rgb ones flash red, the color change is what makes it difficult i think.waaren wrote:@snellejellep, Should be possible but some questions:snellejellep wrote: ↑Monday 10 September 2018 21:20 i have a wish and i do not know how to realize it, i have a button connected to domoticz which i want to use as a doorbell, when the doorbell is pressed i want some lights to flash, but is there a possibility to store the state of the light, activate a doorbell scene and after the scene restore the state off the lights.
- are these standard on/off, -dimlights or rgbw type of lights
- howto "flash" these lights? Simple on/off or something else ?
Also i wanted to use the data from my motion sensors to let the lights flash only in the rooms people are
But first wanted to start with just the flashing
Code: Select all
-- doorbell actions
return {
on = { devices = {"Doorbell" } },
logging = { level = domoticz.LOG_DEBUG, -- switch to LOG_INFO when results are OK
marker = "doorbell actions" },
execute = function(dz, trigger)
if trigger.state == "Off" then -- No action needed when doorbell switch back to Off state
return
end
local rgbwLights = {"Hue lightstrip","Hue Go","Hue rgbw1","Hue etc"} -- table with rgbwlights that need to flash red
local whiteLights = {"lamp1","lamp2","lamp999"} -- table with white lights that need to flash
local function flashRGBWLights()
local redflashDelay = 20 -- delay in seconds
for i = 1,#rgbwLights do -- walk the table from first (1) to last (#rgbwLights)
local loopDevice = dz.devices(rgbwLights[i])
local colorTable = dz.utils.fromJSON(loopDevice.color)
dz.log(loopDevice.name .. " ;state ===>> " .. loopDevice.state,dz.LOG_DEBUG)
loopDevice.setRGB(255,0,0) -- Turn to RED
loopDevice.switchOn()
loopDevice.setRGB(colorTable.r, colorTable.g, colorTable.b).afterSec(redflashDelay)
if loopDevice.state == "Off" then
dz.log("Schedule switchOff for " .. loopDevice.name,dz.LOG_DEBUG)
loopDevice.switchOff().afterSec(redflashDelay)
end
end
end
local function flashWhiteLights()
local whiteflashDelay = 1 -- delay in seconds
for i = 1,#whiteLights do -- walk the table
local loopDevice = dz.devices(whiteLights[i])
local state = loopDevice.state
dz.log(loopDevice.name .. " ;state ===>> " .. loopDevice.state,dz.LOG_DEBUG)
if loopDevice.state == "Off" then
loopDevice.switchOn()
loopDevice.switchOff().afterSec(whiteflashDelay)
else
loopDevice.switchOff()
loopDevice.switchOn().afterSec(whiteflashDelay)
end
end
end
flashRGBWLights()
flashWhiteLights()
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
-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
Re: doorbell script
thank you, it works great!
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
-
- Posts: 92
- Joined: Friday 08 November 2019 23:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: doorbell script
waaren wrote: ↑Tuesday 11 September 2018 1:02Maybe this example script will help in what you want to achieve. Another line of approach could be to trigger an IFTTT applet from this dzVents script.snellejellep wrote: ↑Monday 10 September 2018 21:40I use philips hue lights, some are rgb, some just white, i tought about just flashing the white ones and letting the rgb ones flash red, the color change is what makes it difficult i think.waaren wrote:
@snellejellep, Should be possible but some questions:
- are these standard on/off, -dimlights or rgbw type of lights
- howto "flash" these lights? Simple on/off or something else ?
Also i wanted to use the data from my motion sensors to let the lights flash only in the rooms people are
But first wanted to start with just the flashing
Code: Select all
-- doorbell actions return { on = { devices = {"Doorbell" } }, logging = { level = domoticz.LOG_DEBUG, -- switch to LOG_INFO when results are OK marker = "doorbell actions" }, execute = function(dz, trigger) if trigger.state == "Off" then -- No action needed when doorbell switch back to Off state return end local rgbwLights = {"Hue lightstrip","Hue Go","Hue rgbw1","Hue etc"} -- table with rgbwlights that need to flash red local whiteLights = {"lamp1","lamp2","lamp999"} -- table with white lights that need to flash local function flashRGBWLights() local redflashDelay = 20 -- delay in seconds for i = 1,#rgbwLights do -- walk the table from first (1) to last (#rgbwLights) local loopDevice = dz.devices(rgbwLights[i]) local colorTable = dz.utils.fromJSON(loopDevice.color) dz.log(loopDevice.name .. " ;state ===>> " .. loopDevice.state,dz.LOG_DEBUG) loopDevice.setRGB(255,0,0) -- Turn to RED loopDevice.switchOn() loopDevice.setRGB(colorTable.r, colorTable.g, colorTable.b).afterSec(redflashDelay) if loopDevice.state == "Off" then dz.log("Schedule switchOff for " .. loopDevice.name,dz.LOG_DEBUG) loopDevice.switchOff().afterSec(redflashDelay) end end end local function flashWhiteLights() local whiteflashDelay = 1 -- delay in seconds for i = 1,#whiteLights do -- walk the table local loopDevice = dz.devices(whiteLights[i]) local state = loopDevice.state dz.log(loopDevice.name .. " ;state ===>> " .. loopDevice.state,dz.LOG_DEBUG) if loopDevice.state == "Off" then loopDevice.switchOn() loopDevice.switchOff().afterSec(whiteflashDelay) else loopDevice.switchOff() loopDevice.switchOn().afterSec(whiteflashDelay) end end end flashRGBWLights() flashWhiteLights() end }
the script works great but the brightness stays at 100 percent, can it be returned to the preset brightness of the rgb lights
Who is online
Users browsing this forum: No registered users and 1 guest