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

Going crazy - need help with LUA : 1 Lamp, 2 or more wall switches


D4RK1

Question

Hi,

 

hope someone can help me. I´m new to LUA and programming in general and I am trying to get a simple (so I thought) scene to work.

 

What I want to do:

 

I have a lamp in my dining room which is connected to a fibaro rgbw controller. I have two (or maybe three) wall switches connected to fibaro dimmer 2 and fibaro double switch 2. The lamp and switches are working as they should. If I program them indepently, they control the lamp.

Now I want to have them control the lamp together. So if either of the switches is set to "On", the lamp should switch On as well and vice versa.

I have been fiddling around with several ideas but nothing works as intended. Right now I am trying 2 switches and 1 lamp, I might want to add another switch later, but that is not important now.

Currently I am thinking that I need to change the value of the "other" switch to match the switch I used to control the lamp.

Meaning I Turn Switch1 "On" and Lamp and Switch 2 are set to "On". The problem is, the state change of Switch 2 triggers the scene again. At least I think that is the problem.

 

I cannot believe that I am the first or only one that wants to control 1 lamp with several switches.

 

If someone has a working script for this, please share =)

 

Regards, Jens

 

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I would use associations. That way you do not have to write a scene. 

Please login or register to see this link.

Please login or register to see this link.

Edited by Thomasn
Link to comment
Share on other sites

  • 0
  • Inquirer
  • Hi, thank you for your answer, I am willing to try associations, but I am not sure I understand how it is done. Since I am using the wall switch connected to S2 on my Double Switch 2, I will need to associate the rgbw controller in group 4 if I only want to turn it on or off. If I want to use dimmer functions I have to associate it in group 5? And since I want to control the lamp, the lamp is only set to slave, right?

    Do I add the second wall switch (S2 on another Double Switch 2) in here or do I open the Association dialog from the Second Double Switch and associate it with the rgbw from there?

     

    For now I would be happy if it works with associations, but for future use I would still like to know how to program it in a scene, since more complex functionalities can be accomplished by scenes.

     

    Regards, Jens

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi,

     

    I managed to get it working. Maybe someone else wants to do a similar or the same thing, so here is the simple scene I came up with:

     

    Please login or register to see this code.

    As you can see, the status of the switch is not relevant here. In effect you will get switches that are on even if the lamp is off, and vice versa. If you can live with that and do not want to use associations, this might be the way to go. If someone has better ideas, please go ahead and post them!

     

    Regards, Jens

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