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


Question

Posted (edited)

Hello

 

i am tying to create a toggle button on my vd. i cant get it to work.
 

 

Please login or register to see this attachment.

Please login or register to see this attachment.

Edited by marius de jong

5 answers to this question

Recommended Posts

  • 0
Posted (edited)

@marius de jong

I found this, perhaps is this wat you looking for. 

Please login or register to see this link.

 

And in button 1 and 2 you must set a string or a lua code.

 

And what is what you set on or off?

 

Edited by Reinhold
  • 0
  • Inquirer
  • Posted

    i tryed that solution but it does not work.

    • 0
    Posted

    Please login or register to see this code.

    replace 194 with your deviceid you want to switch on/off

    so:

    Local lamp = 128;

    then you do have to replace all the items in the code from christmasTree to lamp

    • 0
  • Inquirer
  • Posted

    no it does not work it does not turn it off or on. 

    Please login or register to see this attachment.



    i tryed this code. it goes 0ff and changes the icon to off but it does not turn it on

     

    local IconOn = 1001;

    local IconOff = 1002;

    local ThisDevice = fibaro:getSelfId();

    if Status == "IconOff" then
         fibaro:call(ThisDevice, "pressButton", "1");
         fibaro:call(ThisDevice, "setProperty", "currentIcon", IconOn);
         fibaro:debug("turned on light");
     else
         fibaro:call(ThisDevice, "pressButton", "2");
         fibaro:call(ThisDevice, "setProperty", "currentIcon", IconOff);
         fibaro:debug("turned off light");
    end  
    --


    Please login or register to see this attachment.

     

    Please login or register to see this attachment.

    • 0
    Posted (edited)

    Please login or register to see this code.

    try this in your VD

     

    Edited by samuel
    • 0
  • Inquirer
  • Posted (edited)

    i have it working now. i had to create a global value. "woonkamerlicht"
    and only a 1 button vd

    Please login or register to see this attachment.

     

    local IconOn = 1001;
    local IconOff = 1002;

    local ThisDevice = fibaro:getSelfId();

    local value = fibaro:getGlobalValue('woonkamerlicht')
     
    if (value == '1') then
         fibaro:call(ThisDevice, "setProperty", "currentIcon", IconOn);
         fibaro:setGlobal( 'woonkamerlicht', 2);
         fibaro:startScene(20)
         fibaro:debug("turned on light");
     else
         fibaro:call(ThisDevice, "setProperty", "currentIcon", IconOff);
         fibaro:setGlobal( 'woonkamerlicht', 1);
         fibaro:startScene(23)
         fibaro:debug("turned off light");
    end  
    --

    Edited by marius de jong

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