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

"Scene activation" with relays


StarkJohan

Question

Original post kept for archiving purposes. I also like the idea of quoting my self

Please login or register to see this image.

/emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

I'm trying to activate scene with double and triple click using fibaro relays. I'm rather new to LUA and I'm losing myself in the attempts to differentiate between number of clicks. I'm able to detect number of clicks but not separate them. I.e. one click triggers one click but two clicks trigger one and two clicks. Been at this for hours with no luck. I guess using global variables in the only way to get this done and it has to be possible. Please show me in the right direction, I'm sure this has been done before as I possibly can't be the only one with 1x3kWh relays installed with two buttons.

[ Added: 2013-12-14, 15:50 ]

Ok, I managed to construct a solution that works rather well. I don't know LUA and fibaro well enough to say that there isn't a smarter or more flexible solution but at least this runs for multiple switches and number of clicks. In theory an infinite number of clicks could be counted to start any number of different scenes with any relay (or dimmer if needed).

Two global variables are required for each ID to be used, "Count_ID" and "RunLock_ID".

Please login or register to see this code.

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

I think it's not a good idea to use scripts for handling high-speed events like double-triple clicks. It just does not work fast enough. I use similar technology for water counters, but they generate no more than 1-2 events per minute, in this case it works fine.

If you need multiply clicks use Fibaro dimmer and scene activation functionality. Fibaro dimmer has build-in support for double and triple click.

I use double clicks (with dimmer) sometimes, but triple click is uncomfortable for me.

Link to comment
Share on other sites

  • 0
  • Inquirer
  • I think it's not a good idea to use scripts for handling high-speed events like double-triple clicks. It just does not work fast enough. I use similar technology for water counters, but they generate no more than 1-2 events per minute, in this case it works fine.

    If you need multiply clicks use Fibaro dimmer and scene activation functionality. Fibaro dimmer has build-in support for double and triple click.

    I use double clicks (with dimmer) sometimes, but triple click is uncomfortable for me.

    1. I don't see how that comment can in any way be useful for anyone reading the initial post.

    2. If it's uncomfortable for you to use multiple clicks, don't. If it bothers you that other people do, try one of these:

    Please login or register to see this link.

    3. Regarding dimmers instead: I also use double and triple clicks with my dimmers and from a user perspective this script handles exactly the same (so far). There is a reason fibaro supply both dimmers and relays. I'm trying to supply a method to add missing functionality to the relays to make my life, an possible the life of other users, easier.

    4. Regarding the speed of the script, I've been testing it for hours and I've had no "speed" issues so far. As the topic states I'm using the relays (2x1,5 and 1x3). The wait can easily be increased to fit your needs.

    Any constructive criticism is very welcome.

    Link to comment
    Share on other sites

    • 0

    Hi.

    1st - THX for script. From my perspective - looks nice (quite interesting use of multithread functionality

    Please login or register to see this image.

    /emoticons/default_biggrin.png" alt=":D" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> ).

    2nd - What about LONG press?

    Regards

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I don't know how one would detect a long press.

    I can't think of any situation in my own setup that would benefit of a long press so I won't spend any time trying to get that functionality into this script (for now).

    Link to comment
    Share on other sites

    • 0

    Yes, I doubt we can do that without firmware update on the relay units.

    I'd like to see equivalent functionality on the switches as we have with the dimmers. I don't see any reason why Fibaro cannot offer that.

    As it is today, the dimmer unit is far superior as a scene controller than the switch unit.

    Link to comment
    Share on other sites

    • 0

    I was looking exactly for an analogue of dimmer's "41. Scene activation functionality" in switch. And here it is. Thank you Johan for sharing the script! Great job!

    P.S. Hope Fibaro will implement scene activation functionallity also in switches. It would simplify our lifes a lot.

    Please login or register to see this image.

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

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • The use of json would make use of a single global variable possible but as for now the json functions cannot be used in scenes (for some reason). I hope this changes in the future as I can't se any benefits of this. Scenes and virtual devices should be able to use the same code in general.

    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...