Page 1 of 1

Double off tap

Posted: Wednesday 07 November 2018 20:46
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?

Re: Double off tap

Posted: Wednesday 07 November 2018 23:03
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


Re: Double off tap

Posted: Thursday 08 November 2018 0:01
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
}

Re: Double off tap

Posted: Thursday 08 November 2018 7:18
by lvsigo