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


Hold Button to Increment Value (LUA Script) - Universal Binary Sensor


ryanpenny_1

Recommended Posts

 

Hi, 

 

Specific Lua question I'm hoping a more experienced member can help with. 

 

I have a 3-way momentary switch connected to a universal binary sensor which controls my Hue lights via Logic/Lua. I would like to increment the brightness of the Hue lights when the button is held down, I'm comfortable with the Hue control I just don't know how to increment the value for brightness when the button is held. I've attached a screenshot of the scene that I need to add the functionality to, the brightness value is represented by question marks.

 

Please login or register to see this attachment.

 

Any help would be greatly appreciated.

Ryan

 

PS. If anyone would like to know how to trigger a Hue Scene or change the state of a Hue Group I'll post something up. 

 

 

 

Link to comment
Share on other sites

Multilevel devices, like Fibaro Dimmer 2 has folowing:

Please login or register to see this code.

Maybe Hue lights have something similar. Unfortunately, i do not have them, so i cannot test it properly.

Link to comment
Share on other sites

@ryanpenny_1, I have made some code but could not fully test it as I'm not at home. Could you test and give your feedback?

 

Thx, Rene

Please login or register to see this code.

 

  • Thanks 1
Link to comment
Share on other sites

  • Topic Author
  •  

    @ReneNL Thanks for the code. I've tried it out but not managed to get it to function.

     

    There was an error flagged in the brackets of the last statement. I think I have corrected below.

    Please login or register to see this code.

     

    Also the log seems to lock up when running the script and I don't get any debug read-out. Reading through your code along with the Fibaro reference I noticed that Fibaro say that the Json.encode function can't be used in a scene. I wonder if this points to a potential issue? 

    Please login or register to see this link.

     

    I'm going to spend some more time trying troubleshoot and will post back if I can pin anything down.

     

    Lua is still new to me so the help is appreciated

    Link to comment
    Share on other sites

  • Topic Author
  • Actually, just read some more of the Fibaro reference and my comment about specific functions only working within a virtual device seems to be quite common. 

     

    Perhaps I have started on the wrong path by trying to do this as a scene rather than a virtual device?

    Link to comment
    Share on other sites

    @ryanpenny_1, no, this should work in a scene without issues. Can you set debug = true in the beginning of the scene and post the debug messages? I'm skiing  this week so can't test code myself and have a delayed response to your posts.

     

    Rene.

    Link to comment
    Share on other sites

    • 3 months later...

    hi just found this, Im looking for a way to control my hue's with a dimmer switch. does this work so they act like a normal light with a dimmer behind them ( on/off dim up/down) .

    thanks

    ed

    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
    Reply to this topic...

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