Double off tap

Moderator: leecollings

Post Reply
MatthijsD
Posts: 45
Joined: Sunday 19 March 2017 11:48
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Double off tap

Post by MatthijsD »

I've hurt my brain coming up with a solution for this one.
What I would like to do, is when I press an off switch twice withing 5 seconds, a scene is activated that turns off all the lights.

Is there a way to do this?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Double off tap

Post by waaren »

MatthijsD wrote:I've hurt my brain coming up with a solution for this one.
What I would like to do, is when I press an off switch twice withing 5 seconds, a scene is activated that turns off all the lights.

Is there a way to do this?
Should be doable with a script.

Verstuurd vanaf mijn ONEPLUS A6003 met Tapatalk

Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Double off tap

Post by waaren »

MatthijsD wrote: Wednesday 07 November 2018 20:46 I've hurt my brain coming up with a solution for this one.
What I would like to do, is when I press an off switch twice withing 5 seconds, a scene is activated that turns off all the lights.

Is there a way to do this?
Would not know a solution with Blockly but with dzVents it could look like:

Code: Select all

-- doubleTap
local switchName = "dblTapSwitch"          -- Name  of your triggerSwitch 
local sceneName  = "dblTapScene"           -- Name of the Scene that will be triggered by double tap switch Off

return {
    on   =    { devices   =   { switchName }},
    
--    logging =   {   level   = domoticz.LOG_DEBUG ,     
--                    marker  = "doubleTap"},            
    
    data =  { lastState =  { initial = "Off" }},

    execute = function(dz, item )
        if item.state ==  "Off" and dz.data.lastState == "Off" and item.lastUpdate.secondsAgo < 6 then 
            dz.scenes(sceneName).switchOn()
        end          
        dz.data.lastState = item.state
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
lvsigo
Posts: 14
Joined: Thursday 24 November 2016 12:14
Target OS: Linux
Domoticz version:
Contact:

Re: Double off tap

Post by lvsigo »

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest