Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Scripts for one-, double-, triple-clicks on a Relay Switch


Jkjellen

Question

I am a beginner at Fibaro and maybe my question is simple for you experienced users.

I wonder if anyone has tips on scripts that allow S1 + S2 buttons on Fibaro Double Relay Switch (and/or Singel Relay), which makes the buttons work as one-, double-, triple-click, etc. (as it does with ScenActivation on a Fibaro Dimmer )?

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

Jkjellen,

Unless Fibaro Relay Switch is not scene activation device then it will be difficult. You can of course create proper scene, that will monitor the output state and after for example third click it will activate something, however the easiet way is to use Scene activation device (UBS or D/W sensor for example).

Link to comment
Share on other sites

  • 0

Hi, this is my virtual device that can handle x click.

In %%properties you set up the switch ID.

You must create 2 globals var. with name Count_ and RunLock_

The line

Please login or register to see this code.

config the action, we can read :

Switch 88 on 2 clicks start scene id 17

You can use "pressButton" as action but you must add a new parameter "button" with the button number like this :

Please login or register to see this code.

My code is not the simplest, but it permit to have only one scene that handle all my switch.

Steve

Please login or register to see this code.

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Many thanks. Impressed. I will try it when I'm back at home on Wednesday.

    [ Added: 2014-02-26, 10:09 ]

    Hi Poppy

    Some questions to be sure I understand:

    1.

    How do I create 2 globals var? Is it enough with following in the same script

    --[[

    %% properties

    88 value

    %% globals

    Count_88

    RunLock_88

    --]]

    or do I do?

    2.

    When you write: ” You can use "pressButton" as action but you must add a new parameter "button" with the button number like this…….”

    do you mean ”You need to use”, or it is a option, and what/where should I do, is it included in the script so I do not need to do anything? Please explain a little bit more for a beginner how want to learn.

    3.

    Just so I understand. If I have 10 buttons and I want all buttons to have one, double and triple click. Should I then create sum 30 action scenes, plus for each a trigger scene with you LUA-trigger code. Have I understand it right.

    Link to comment
    Share on other sites

    • 0
    Hi, this is my virtual device that can handle x click.

    In %%properties you set up the switch ID.

    You must create 2 globals var. with name Count_ and RunLock_

    The line

    Please login or register to see this code.

    config the action, we can read :

    Switch 88 on 2 clicks start scene id 17

    You can use "pressButton" as action but you must add a new parameter "button" with the button number like this :

    Please login or register to see this code.

    My code is not the simplest, but it permit to have only one scene that handle all my switch.

    Steve

    Please login or register to see this code.

    How can i configure more actions? if 2 clicks action 1, 4 clicks action 2

    local actions = { [88]={ [2]={{type = 'scene', id = 17}} } }

    local actions = { [88]={ [4]={{type = 'scene', id = 18}} } }

    doesn't work because i overwritten the actions value (only the last one works), can you give me an example?

    Thanks in advance.

    Link to comment
    Share on other sites

    • 0

    you can use this code :

    Please login or register to see this code.

    I'am thinking adding a more simple add function. But i'am very busy at work, will try to do it this weekend.

    Steve

    Link to comment
    Share on other sites

    • 0

    For test i used this code:

    local actions = { [60]={ [6]={{type = 'scene', id = 13}}}, [60]={ [8]={{type = 'scene', id = 13} }} } -- couloir switch 60, control scene 13

    Only the 2nd option works

    Please login or register to see this image.

    /emoticons/default_icon_cry.gif" alt=":cry:" />

    [DEBUG] 21:01:40: 8/scene/13

    [DEBUG] 21:01:40: End count: 8

    [DEBUG] 21:01:49: Nothing to do

    [DEBUG] 21:01:49: End count: 6

    [DEBUG] 21:01:55: 8/scene/13

    [DEBUG] 21:01:55: End count: 8

    [DEBUG] 21:02:08: Nothing to do

    [DEBUG] 21:02:08: End count: 6

    Link to comment
    Share on other sites

    • 0

    I corrected your line :

    Please login or register to see this code.

    This stand to say that this script need a configuration function.

    I will try to add this weekend two functions :

    - addScene("Trigger DeviceId", "number of click", "SceneId")

    - addPressButton("Trigger DeviceId", "number of click", "ButtonId", "ButtonNumber")

    with that it will be easier to add actions.

    Steve

    Link to comment
    Share on other sites

    • 0

    Thanks, the corrected line works!

    It would be nice, to use one script for all multiple actions of the switches. Now i have for each switch id a separate script. Tonight i will try to combine my scripts in to one script with the new action line.

    Thanks for your help, I look forward to the update of the script

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    Link to comment
    Share on other sites

    • 0

    I recognize a lot of the basic functionality of that code…

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    Nice work on making it more dynamic!

    Link to comment
    Share on other sites

    • 0

    I don't remenber were i found the base script and lazy to search. I will add your name in the credit of the next version.

    Steve

    [ Added: 2014-04-06, 09:39 ]

    Hello,

    You can find

    Please login or register to see this link.

    the updated script

    Steve

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...