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

VD "Main" toggle switch


Question

Posted

Howdy! Quick question, hopefully:

 

In order to have a "Main" button in a VD be a toggle switch, and to reflect the state, I've had to use a global variable as well as manual icon selection, as follows:

 

Button 1 (Main) - this is the toggle switch

local curmode=fibaro:getGlobalValue('innerwall_mode');
curmode = (curmode + 1) % 4

fibaro:call(fibaro:getSelfId(), "pressButton", 2+curmode)

 

Button 2

fibaro:setGlobal('innerwall_mode',0);
fibaro:call(fibaro:getSelfId(), "setProperty", "currentIcon", 1011);

-- more code

 

Button 3

fibaro:setGlobal('innerwall_mode',1);
fibaro:call(fibaro:getSelfId(), "setProperty", "currentIcon", 1012);

-- more code

 

Button 4

fibaro:setGlobal('innerwall_mode',2);
fibaro:call(fibaro:getSelfId(), "setProperty", "currentIcon", 1013);

-- more code

 

Button 5

fibaro:setGlobal('innerwall_mode',3);
fibaro:call(fibaro:getSelfId(), "setProperty", "currentIcon", 1014);

-- more code

 

This does the job, but it's a lot of manual labour to duplicate.

 

1) Is there a way to do this without having to define a global variable?

2) Is there a call to get the ID of the currently selected icon for that button, so that I don't have to hardcode the ID of each icon?

 

Either would help, both would be phenomenal. :)

 

 

 

 

Please login or register to see this attachment.

Please login or register to see this attachment.

3 answers to this question

Recommended Posts

  • 0
Posted

ex. use icon code for retrieve last pressed button by:

fibaro:getValue( fibaro:getSelfId() , "deviceIcon")  -- for VD icon

but if you need check icon on z-wave device use fibaro:getValue(devID, "currentIcon")

 

  • 0
  • Inquirer
  • Posted

    Thanks for your reply @drboss . However, your example retrieves the ID of the main VD icon only, not the icon of the last pressed button.

     

    Your example was however enough of a pointer to search further, and I found the following:

    This topic from almost 4 years ago asks for the exact same thing I'm asking for, although the request was perhaps not as clearly stated.

     

    This leads me to believe perhaps it does not yet exist? This would be another nice feature to have.

     

    • 0
    Posted

    I’m not sure I answer your question but you can get the id of the pressed button

     

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