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

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]

Link to comment
Share on other sites

Recommended Posts

  • 0
Guest merylion
  • Inquirer
  • Hello,

    I am trying to use it for Polish language,

    Unfotunately once our "special characters" appears it cuts a word into two parts.

    Anyway works as it should not,

    I have used translate.google.pl and copied link with one work which is spelled propertly into script and still got no proper pronounciation.

    Anyone have any idea?

    Regards

    Marcin

    Link to comment
    Share on other sites

    • 0

    I want to receive help with the following. Lua code below I have in a virtual drive. I get the temperature read in my sonos. Now I want to put text before and after. Tex current temperature outside is .. Value. Degrees. Someone who can help.

    PlayTTS ("Sv, (fibaro: getValue (96," value ")), nill, 40);

    This string says only number

    [ Added: 2014-02-27, 22:16 ]

    Krikroff, I want to receive help with the following. Lua code below I have in a virtual drive. I get the temperature read in my sonos. Now I want to put text before and after. Tex current temperature outside is .. Value. Degrees. Someone who can help.

    PlayTTS ("Sv, (fibaro: getValue (96," value ")), nill, 40);

    This string says only number

    Link to comment
    Share on other sites

    • 0
    Guest merylion
  • Inquirer
  • do this:

    PlayTTS ("Sv", "Outside temperture is " .. (fibaro: getValue (96," value ")) .. " degrees celsius", nill, 40);

    Link to comment
    Share on other sites

    • 0
    do this:

    PlayTTS ("Sv", "Outside temperture is " .. (fibaro: getValue (96," value ")) .. " degrees celsius", nill, 40);

    ______________________________________

    Thanks so much! Now it works perfectly.

    Now I can enjoy my sonos again

    Calle

    Link to comment
    Share on other sites

    • 0
    Guest merylion
  • Inquirer
  • KIRKOFF:

    Can you share your virtual device for Sonos?

    I am trying to do something universal but no luck

    Regards

    Marcin

    Link to comment
    Share on other sites

    • 0

    I apologize for the long wait ... You can find my virtual device on a French forum dedicated to Fibaro system where I spend a lot of time

    Please login or register to see this image.

    /emoticons/default_icon_rolleyes.gif" alt=":roll:" />

    Please login or register to see this link.

    Enjoy

    Please login or register to see this image.

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

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    It looks great Krikroff but I cant download the file from the French forum.

    I created an account but I get "Permission denied" when I try to download the file.

    Can you please put the code in Github/Bitbucket or some place we can all contribute to the project.

    Link to comment
    Share on other sites

    • 0
    It looks great Krikroff but I cant download the file from the French forum.

    I created an account but I get "Permission denied" when I try to download the file.

    Can you please put the code in Github/Bitbucket or some place we can all contribute to the project.

    I have the same problem

    Please login or register to see this image.

    /emoticons/default_icon_rolleyes.gif" alt=":roll:" />

    Please login or register to see this image.

    /emoticons/default_icon_idea.gif" alt=":idea:" />

    Link to comment
    Share on other sites

    • 0

    I cannot download it also, really look forward to this great plugin!!!

    Please login or register to see this image.

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

    Link to comment
    Share on other sites

    • 0

    hello all

    I am an admin of "domotique-fibaro.fr" forum.

    To download and participate in the life of the forum you must submit in section "présentation":

    Please login or register to see this link.

    It's a french forum so please post in french language...use google translate...

    Please login or register to see this image.

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

    If you have any problems you can contact me by e-mail to [email protected]

    Philippe

    Link to comment
    Share on other sites

    • 0

    Thanks! I have downloaded the file but how do I create such global variables? I have absolute no idea how. Thanks!

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

    Link to comment
    Share on other sites

    • 0
    Thanks! I have downloaded the file but how do I create such global variables? I have absolute no idea how. Thanks!

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

    Go to

    Please login or register to see this link.

    replace x.x.x.x with you HC2 IP, and click Add

    Link to comment
    Share on other sites

    • 0

    This really works great!!

    The only problem i've got is it can't say Å Ä Ö in swedish, it speaks swedish (sv) as long as no Å Ä or Ö is in the sentence ... Is it possible that it's impossible to use åäö in the LUA code?

    Is there some other way to write swedish sentences with å ä ö in them, like ascii?

    It just turns quiet when i include å ä or ö, but without them it works great ...

    Link to comment
    Share on other sites

    • 0
    So guys, I've been spending the past two days trying to solve this Sonos Text-to-Speech.

    I have decided to move it out of HC2 into a Node.JS app as I found a good API I could build upon.

    The work can be found at:

    Please login or register to see this link.

    Currently we have a proof of concept where the player name is hardcoded (Living Room in the commit on line # 276).

    Usage is: localhost:5005/ttsall/text+to+speech

    Doing a HTTP get from HC2 on events is simple so that's no problem.

    This would get livingroom to speech a voice from Google's TTS engine saying "Text to speech". If a speech already has been downloaded it would not have to download it again.

    Later on in the project I believe I will run this on a server where it downloads the messages to a CIFS share as Sonos seem to be slow to start Radio streams.

    Just realised I did not include the repository.

    Please login or register to see this link.

    It is not fully functional yet, since it does not restore Sonos completely to the previous configuration - as soon as that gets solved it is perfect for my use.

    Any feedback is greatly appreciated. If you find a way to solve the restoration please create a patch.

    To test the usage you can go to

    Please login or register to see this link.

    and you will be presented by an webUI to send post data with the text-to-speech.

    Later on I will release the fibaro notification engine I use to have relevant information spoken as soon as they are available.

    Link to comment
    Share on other sites

    • 0
    hello all

    I am an admin of "domotique-fibaro.fr" forum.

    To download and participate in the life of the forum you must submit in section "présentation":

    Please login or register to see this link.

    It's a french forum so please post in french language...use google translate...

    Please login or register to see this image.

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

    If you have any problems you can contact me by e-mail to [email protected]

    Philippe

    I am not able to find the submit option in section presentation. Please help, I am felling kind of stupid

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

    Link to comment
    Share on other sites

    • 0

    I am currently integrating my Sonos system into Fibaro.

    Everything works fine, but I run into a problem.

    I want to show the current artist and track info in to a label.

    My code

    Please login or register to see this code.

    There is no output visible, but when i look with the Intel Device Spy Tool for UPnP the output is visible.

    Please login or register to see this image.

    Can anyone help me to get the correct information?

    I've been looked to the virtual device from Krikroff but the script is too complex to take only that specific part out of it.

    Thanks in advance

    Sorry for my bad english.

    Link to comment
    Share on other sites

    • 0

    No luck.

    I have HC2 + Sonos bridge + Sonos Play:1.

    I have installed Sonos, and can control it from PC, iOS, Android.

    But no luck in TCP virtual device.

    And no luck to import virtual device from french site.

    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.

    And even rebooted HC2 ...

    "The pause command was sent" - but no change in Sonos - it' still plays.

    Any ideas?

    Link to comment
    Share on other sites

    • 0

    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

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