Double off tap

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

Double off tap

Post by MatthijsD » Wednesday 07 November 2018 21: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?

User avatar
waaren
Posts: 1238
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Double off tap

Post by waaren » Thursday 08 November 2018 0:03

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

Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

User avatar
waaren
Posts: 1238
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Double off tap

Post by waaren » Thursday 08 November 2018 1:01

MatthijsD wrote:
Wednesday 07 November 2018 21: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
}
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

lvsigo
Posts: 18
Joined: Thursday 24 November 2016 13:14
Target OS: Linux
Domoticz version:
Contact:

Re: Double off tap

Post by lvsigo » Thursday 08 November 2018 8:18


Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests