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

Switch scene when state of wallswitch is changed


Question

Posted

Hello,

With some help from this forum i created the following scene for my TKB wallswitch:

Please login or register to see this code.

This works ok, but there is a downside. When i activate the scene with my iPad, for example scene 3 (lights on), i have to switch the wallswitch 2 times to activate scene 4 (lights off).

Is it possible to switch the scenes if the state of the wallswitch changes instead of the value?

4 answers to this question

Recommended Posts

  • 0
Posted

Can you paste scene 3.

With adding an OR statement to the IF we should fix it, but then we have to know the lights you enable in scene 3.

  • 0
  • Inquirer
  • Posted

    Hi Remko, thanks for your quick reply.

    Here is my scene 3 (livingroom on)

    Please login or register to see this code.

    I don't know why the scene is inportant by the way

    Please login or register to see this image.

    /emoticons/default_icon_confused.gif" alt=":-?" /> .

    To make it a little bit more clear:

    When the wallswitch changes the state (0 to 1 or 1 to 0) the correct scene has to be pressed. There is one scene that says: livingroom on, the second scene is livingroom off.

    There is some part of the code that has to check if the scene is active or not i think.

    pfff, one day is can write lua code i hope

    Please login or register to see this image.

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

    • 0
    Posted

    You can do it in 2 ways:

    1:

    If you change the if statement to:

    if (lightlevel == 1 and tonumber(fibaro:getValue(21, "value")) == 0) then

    It now also checks if device 21 is off and if so it "thinks"woonkamer is off so runs scene 3, otherwise scene 3

    I don't know if 21 is only used in the 3 scenes, but it should be.

    2:

    You can add a globalvariable (panels/variable panel) "woonkamer".

    You then have to add fibaro:setGlobal("woonkamer", "1") to scene 3 (after you enable the lights) and setGlobal("woonkamer", "0") to scene 4.

    In the wallswitch scene you then have to change the if statement to:

    if (lightlevel == 1 and fibaro:getGlobal("woonkamer") == "0") then

    New scene 3:

    Please login or register to see this code.

    New wallswitch scene:

    Please login or register to see this code.

    You need to change scene 4 and add woonkamer in the variables panel!

    Solution 2 is a cleaner solution in my opinion.

    Succes!

    • 0
  • Inquirer
  • Posted

    Thanks for the complete tutorial Remko, it works great. It is even woman-proof now

    Please login or register to see this image.

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

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