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

FOR commands


Danielos

Question

Dear all,

 

I'm using this script to pause my SONOS VD 63 and 65..... As you see, I just repeated the whole code for both. ;-)

 

There are some more SONOS VD's in my house. So I don't want to repeat the code for every VD. I'm sure there is a better way to make this with a FOR syntax. Could someone help me for that?

 

Thank you very much!

 

Dan

Please login or register to see this code.

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi @Danielos ,

 

You don't really need to use above code to control Sonos remote VD. All you need is a table of Sonos VD ID numbers and then loop through that table and press needed button or set volume slider on the VD. Here is example of changing volume of all Sonos speakers to 10% volume:

Please login or register to see this code.

Same is with pressing buttons, you can stop all Sonos speakers with following code:

Please login or register to see this code.

Also can start playing if you set buttonID to "7". Of course all above is valid for Sonos Remote VD from @Krikroff.

 

Enjoy coding :-) 

Edited by Sankotronic
Replaced hc with fibaro
Link to comment
Share on other sites

  • 0
  • Inquirer
  • @Sankotronicthank you very much!!

     

    Unfortunately, I receive an error...

     

    Please login or register to see this code.

     

    With that script:

     

    Please login or register to see this code.

     

    Any ideas? Thank you so much!


    Dan

    Link to comment
    Share on other sites

    • 0

    Hi @Danielos ,

     

    I have corrected scripts in my previous post so they should work now. You don't need part of code from local _f = fibaro to _f:call(sid,"pressButton", bid) since my code does not use that approach, my scripts press buttons on VD directly.

     

    In all my code I use at the beginning:

    Please login or register to see this code.

    and then I can write Fibaro functions with hc instead of fibaro as in bellow example:

    Please login or register to see this code.

     

     

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