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

Working SONOS VD and TTS workaround - quick install guide


morpheus75

Question

hello all.

i have just bought some Sonos speakers and wanted to integrate with home center 2. 

first part is to control then second part text-to-speech workaround

 

whilst i was going through the forums i found the info i needed scattered around different threads and the original thread was very long, so i have thought i might make it easier by creating a small quick guide:

 

First thing is all credit to the virtual device goes to krikroff for the VD, original thread here -  

Please login or register to see this link.

 

I have created a video demo instead as it was easier to show rather than write.

 

 

 

video link is as above.

 

enjoy...

 

download link here:    

Please login or register to see this link.

Edited by morpheus75
update video link
  • Like 2
Link to comment
Share on other sites

Recommended Posts

  • 0

Thanks for this!

I do have one question, I hope you can help me with that.

When a file has played, I lost my playlist. So I cannot simply press the play button on my Sonos.

Is there a way to "save" the playlist in a variable or something like that?

Link to comment
Share on other sites

  • 0
  • Inquirer
  • I know, that is the issue at the moment. I am going to have a look to see if I can find anything on this or try something myself. Theory of creating a play list file and use that in a variable is what I will be exploring

    Link to comment
    Share on other sites

    • 0

    Thanks, this is great !!!!

     

    Looking forward to the solution of the "playlist" issue.

     

    maybe you can add the link to the download at your post, it took me a while to get the url right. .... (my English is not so very good

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

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • ive been doing some reading and it looks like the playlist files cannot be extracted from sonos. there is no way to backup a sonos playlist either. so at the moment i cannot 'read' what playlist is currently being played before we send our notification file.

    however we can add a playlist file so that after an announcement it can play a playlist .m3u file.

    the issues with this is that you have to create your own separate m3u playlist file and store it with your music, once you have refreshed the sonos library using the sonos app you can store the path for this file into a variable and call it to play using the krikroff VD so that it plays all the tracks and not just 30 secs worth.

    you will not see a list in the queue, only the single m3u file but whilst it is playing the music you will see the track name that is being played.

     

    so unfortunately looks like the existing playlist is effectively lost and has to be restarted manually after using notifications this way comapred to TTS.  so hopefully TTS funcionality will be restored soon and we can go back to that method where it will not disturb our playlists.

     

    on the plus side it does give us a way to send a playlist to the Sonos.  

    Create a new variable and a VD with how many buttons you need.

    create your playlist files and assign each 1 to a VD.

    code each button to 'setGlobalValue' to your new variable and press play button on the krikroff VD instead

    this way you can use fibaro to start your specified playlist by pressing a VD button or using a scene...

     

    hope that all makes sense. 

    Link to comment
    Share on other sites

    • 0

    I also DO have the problem with TTS, so that's not different for me.

     

    You can see the playlist in Fibaro. If I go to "

    Please login or register to see this link.

     then I see an " ui.playlist.value" with my current playlist in Sonos.

    Maybe we can do something with that? I really don't now.

     

    Thanks for your effort!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • ok i will look into that when i get home and see if anything can be done. thanks

    Link to comment
    Share on other sites

    • 0

    Great! Let us know

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I also DO have the problem with TTS, so that's not different for me.

     

    You can see the playlist in Fibaro. If I go to "

    Please login or register to see this link.

     then I see an " ui.playlist.value" with my current playlist in Sonos.

    Maybe we can do something with that? I really don't now.

     

    Thanks for your effort!

    hi

    im not getting the ui.playlist.value appearing in my options

    also been testing the m3u file in the variable and it is working almost perfectly.

     

    after changing the variable to point to a m3u file intsead of the mp3 file it pre-loads the playlist with multiple files instead of a single file.

    you still have to let it play with the TTS VD first before you can set it to play again with the main VD

    the forward track and previous track still works fine

     

    here is example of what i tried:

     
    line 1 -  fibaro:setGlobal('frontsonos','//Diskstation/Music/frozenTest.m3u')
    line 2 - fibaro:call(190, "pressButton", "1")  
    line 3 - fibaro:sleep(30*1000)
    line 4 - fibaro:call(187, "pressButton", "7")
     
    line 1 sets up the playlist file in the variable
    line 2 loads the file from variable into Sonos and plays roughly 30 secs at the pre-determined volume level ( 50% in my video)
    line 3 the LUA code waits 30 secs
    line 4 it then presses Play again on the main VD app and starts the playlist from beginning at the existing sound level
     
    so far this is the only way i have managed to get the playlists to play

     

    im open to suggestions for better ways, im not a fully fledged programmer but understand the basics only

    Link to comment
    Share on other sites

    • 0

    You don't? Hmm. It's in the Sonos Plugin, not in a VD.

     

    Attached a screenshot how it looks at me.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • i havent installed the sonos plugin. i will do that now and check again

     

    EDIT

     

    installed and checked. i can pull the playlist info and on checking the data it remembers the full path of the music files. 

    i have saved to a variable aswell.

    problem is getting it back into the sonos plugin

    Link to comment
    Share on other sites

    • 0

    I guessed that could be a problem. I really appreciate it, you looking into this so far, thanks.

    Link to comment
    Share on other sites

    • 0

    Nice Compilation of data, and great youtube walkthrough .. this is why Fibaro IMHO needs a wiki ! ..or more morpheus75's

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

    Cheers,

    al.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • hi

    i didnt put any URL for the radio into the VD itself. instead i chose 5 faviourite stations in the Sonos App itself and the VD just picked them up automatically.

    Link to comment
    Share on other sites

    • 0

    This is great , got it going so quickly ,but how do I get it to return to whatever was playing before this event on the Sonos. Any help much appreciated

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • This is great , got it going so quickly ,but how do I get it to return to whatever was playing before this event on the Sonos. Any help much appreciated

     

    that is the question. i cant work that bit out just yet....

    Link to comment
    Share on other sites

    • 0

    Hey there,

     

    looks like all works perfect but i have a problem with my alarm system with the tts workaround.

     

    I have a .mp3 alarm file that last for 3 Minutes.

     

    My problem is that the file get played from both sonos players, but after 30 seconds it stops. Is this a limit for the tts workaround?

     

    So i was thinking it just allows 30 seconds so i just tried to do a while and play the sound again. The problem is that it does just play the sound on one speaker and it ignores the others. Again after 30 seconds it happens that they switch sometimes and so on so it does not work as i want.

    Please login or register to see this code.

    I really hope someone can help me here..

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