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


  • 3

Sonos - Virtual Device


Guest deraaij

Question

Guest deraaij
Posted

Update: Please use TCP as of version 3.x as os.execute has been depreciated. As soon as we are able to have custom headers I will update the LUA code.

Hi all,

For those who are interested I made a Virtual Device based on the new LUA feature (inspired on lua code for MIOS) which can control a sonos device. It uses curl but will change it when the http api is documented. Change the IP address accruing to your needs.

EDIT: Added additional comments from other post which I posted in this thread.

EDIT: Changed req.lua --> /tmp/req.lua which works with beta 3.423 & 3.424

Play

Please login or register to see this code.

Stop

Please login or register to see this code.

Pause

Please login or register to see this code.

Previous

Please login or register to see this code.

Next

Please login or register to see this code.

Mute

Please login or register to see this code.

UnMute

Please login or register to see this code.

Volume – Not Working yet because we do not get the value off: _sliderValue_ @fibaro how does this work with Lua?

Please login or register to see this code.

Example Text-2-Speech using LUA in a scene:

Please login or register to see this code.

Remark: Play is initiated with the last statement to actual play the text (change it accordingly).

Example play song from network with LUA:

Please login or register to see this code.

Remark: Play is initiated with the last statement to actual play the song (change it accordingly).

Example radio station via LUA:

Please login or register to see this code.

Remark: Play is initiated with the last statement to actual play radio (change it accordingly). For now only the radio name is set.

Regards,

Mark[/b]

Recommended Posts

  • 0
Posted

Did you do this?

IMPORTANT : Before importing the device it is essential to create the necessary for the proper functioning of the virtual device global variables.

Type : Variable Name : SonosLastCmd

Type : Variable Name : SonosTTS

  • 0
Posted

yes.

1) I've created variables

2) I've imported file into new virtual device

3) I've entered IP to IP, and 1400 to port.

4) I've saved virtual device.

Please login or register to see this attachment.

  • 0
Posted

Alex57, what information appears in mainloop debug?

  • 0
Posted
Alex57, what information appears in mainloop debug?

Please login or register to see this code.

  • 0
Posted

Superb job from Krikoff!!!

Please login or register to see this image.

/emoticons/default_icon_eek.gif" alt=":shock:" />

I just tested this virtual device and wow!!!

Just one small thing - there was ~3-5sec delay when pressing buttons, can anyone think why it has delay?

Lauri

  • 0
Posted

Trying to add an extra button for NightMode... can anyone see what i have done wrong? please help! So when i turn off projector the sonos playbar makes the sounds softer for normal day to day use and when projector on then i get full sound with plenty of bass etc...

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" />

POST /MediaRenderer/RenderingControl/Control HTTP/1.1

Content-Length: 281

SOAPACTION: "urn:schemas-upnp-org:service:RenderingControl:1#SetEQ"

010x0D0x0A0x0D0x0A

[ Added: 2014-06-21, 18:02 ]

Don't think this is possible looking at 3rd party api and wire shark

Please login or register to see this image.

/emoticons/default_icon_sad.gif" alt=":-(" />

[ Added: 2014-06-21, 22:47 ]

worked it out

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" /> works now!

  • 0
Posted

Can i please have your great plugin as well Krikroff? i get an accsess fault on the Domonique web site even if i have an account

  • 0
Guest Paweł Świerczyński
  • Inquirer
  • Posted

    Hi i have one problem maybe somebody can help me with volume:

    this is my volume code :

    GET /jsonrpc?request={"jsonrpc":"2.0","method":"Application.SetVolume","params":{"volume":_sliderValue_},"id":16} HTTP/1.10x0D0x0A0x0D0x0A

    And its not working

    Please login or register to see this image.

    /emoticons/default_sad.png" alt=":(" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />, all other button works perfectly but I still have problem with volume control....

    • 0
    Posted

    pathduck, you can download last version 0.0.7 at the bottom of my message.

    Original post is here

    Please login or register to see this link.

    Please login or register to see this link.

    • 0
    Guest Paweł Świerczyński
  • Inquirer
  • Posted

    Krikroff, this script works only with HC2 ( althought i can import this on hcl but totaly not work), by the way about HCL i use Test_Julien.vfib all works perfectly besides volume :/

    I have bridge and sonos 3 and 5. I want to make 2 virtual device and control speakers seperetly . With Test_Julien.vfib all works fine besides volume ;/

    • 0
    Posted

    Pablos321, yes my script only works on HC2

    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" />

    • 0
    Posted

    Hi Krikroff,

    I have written a tutorial on integrating iKettle with Sonos on the Home Center 2. I have mentioned you and provided a link to your excellent virtual device in the article.

    Thanks for all your hard work which makes so much possible!

    The tutorial can be found at

    Please login or register to see this link.

    Adam

    • 0
    Posted

    Hi Adam, your tutorial is really nice, good idea and iKettle seems like a very interesting product. I hope it will arrive soon in France.

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Jean-Christophe.

    • 0
    Posted

    Thanks Jean-Christophe,

    I'm surprised that it isn't there yet. They have a friendly support team - I've asked them if they have any plans and I'll let you know what they say

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

    Kind regards,

    Adam

    • 0
    Posted

    I saw that smartthings and sonos can create a "scene" to group all speakers and play siren sound. Is this possible with HC? I guess we just need a button that can play a URL.mp3 file, any idea how?

    the code in smart things is as below for reference:

    Please login or register to see this code.

    • 0
    Posted

    [ERROR] 22:44:35: line 14: attempt to index global 'io' (a nil value)

    what is the problem ?

    • 0
    Posted

    Graba, you dont have that global variable on hc

    • 0
    Posted

    New version 0.0.8 at the bottom of my message.

    Change logs

    Improvement: Play TSS with auto stop mode (set dr parameter to "auto") now works as expected.

    Improvement: Play TTS with fidex duration (set dr parameter to "xx" seconds) now works as expected.

    Patch: Main image is now fixed after pressing a button, thanks to Labomatik & JM13.

    Patch: Bug with XMl parsing for BrowseDirectChildren.

    Warning: To operate the radio shortcuts you must choose at least two favorite radios.

    Original post is here

    Please login or register to see this link.

    Please login or register to see this link.

    • 0
    Posted

    Dear people, I have SONOS3 and HC2 4.017 beta.

    Today I add my sons device to HC2, it's work better. Work play and mute.

    But how I can do scene talk SONOS for example temperature home or outside?

    Please help with new scene add code. And use this SONOS3 at talking speaker

    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" />

    Thanks a lot.

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