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 Sonos player and TTS functionality


Labtec
 Share

Question

Hi,

 

I am looking for a VD for using Sonos wtih my HC2.............yes I have allready searched several topics but it is very difficult for me to find the

complete solution ;-)

 

It would be great :-) if someone can post the vib file including a manual, or give me a link/topic where i can download these files. I want to control my Sonos

via HC2 and additional use the TTS functionality with scenes. So far I understand that I must fill in the IP of the Sonos speaker and use poort 1400? in VD.

 

Thanks

Link to comment
Share on other sites

Recommended Posts

  • 0

The topic has been moved from "

Please login or register to see this link.

" to "

Please login or register to see this link.

".

 

Temat został przeniesiony z "

Please login or register to see this link.

" do "

Please login or register to see this link.

".

Link to comment
Share on other sites

  • 0
19 hours ago, Labtec said:

Hi,

 

I am looking for a VD for using Sonos wtih my HC2.............yes I have allready searched several topics but it is very difficult for me to find the

complete solution ;-)

 

It would be great :-) if someone can post the vib file including a manual, or give me a link/topic where i can download these files. I want to control my Sonos

via HC2 and additional use the TTS functionality with scenes. So far I understand that I must fill in the IP of the Sonos speaker and use poort 1400? in VD.

 

Thanks

 

 

Hi @Labtec

There are two solutions on this forum that allow you to control your sonos with your HC2

 

One leverages a Pi (or similar node.js capable device) to run an api that the HC2 can communicate with

I wrote a tutorial on how to setup and leverage - 

 

 

There is a second solution by @Krikroff . I am not as familiar with this one but you can find details here

 

 

Hopefully one of these will work for you ...

 

_f

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thanks, for now I have installed Krikoff V1.0.1 VD and it is working fine, I can control my Sonos Play 1 from

    HC2. Next is the TTS solution, this seems to be more difficult ;-) for what I have read in the topic there is no

    Dutch language.possible?

    • Like 1
    Link to comment
    Share on other sites

    • 0
    1 hour ago, Labtec said:

    Thanks, for now I have installed Krikoff V1.0.1 VD and it is working fine, I can control my Sonos Play 1 from

    HC2. Next is the TTS solution, this seems to be more difficult ;-) for what I have read in the topic there is no

    Dutch language.possible?

     

    Hi @Labtec,

     

    I use this service 

    Please login or register to see this link.

     and they have Dutch. You need to make api_key here 

    Please login or register to see this link.

     and then put that api_key in code for Process button on Sonos VD.

     

    And then you use this code to send TTS message to Sonos speaker:

    Please login or register to see this code.

    Change 128 with ID code of your Sonos VD. You can use local variable instead of string "Dit is een testbericht". I have this code only in one scene that is triggered when global variable ttsMessage change value. In that variable I send message, volume and ID of the Sonos VD on which I want message to be played.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi Sankotronic,

     

    Thanks, this is perfect for the next step :-) 

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Everything works fine, next is to play a MP3 file from my NAS to my Sonos Play 1, how can I do this?

     

    Thanks :)

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I use the path settings below but no sound from the Sonos speaker

     

    -- stream: the file / uri
    stream = "//192.168.1.250\Public\Fibaro MP3\Burglar-alarm-sound.mp3",

    -- source: "local" or "http", "local" is setted by default
    source = "local",

     

     

    This is the Original code and works, so I change the stream to my NAS IP and path and change the source.

     

    -- stream: the file / uri
    stream = "//s3.amazonaws.com/smartapp-media/sonos/bell1.mp3",

    -- source: "local" or "http", "local" is setted by default
    source = "http",

    Edited by Labtec
    Link to comment
    Share on other sites

    • 0
    Guest
    On 5/11/2017 at 10:17 PM, Sankotronic said:

     

    Change 128 with ID code of your Sonos VD. You can use local variable instead of string "Dit is een testbericht". I have this code only in one scene that is triggered when global variable ttsMessage change value. In that variable I send message, volume and ID of the Sonos VD on which I want message to be played.

     

    @Sankotronic

    Will it be possible to send this to several sonos players at once or do I have to duplicate 9 times to cover my house? :-)

    Link to comment
    Share on other sites

    • 0

    @tortho ,

     

    if sonos speakers are grouped then sending message to master speaker will emit message to all speakers in the group. If not grouped then you have to send message to each speaker separately.

    Link to comment
    Share on other sites

    • 0
    On 5/11/2017 at 10:17 PM, Sankotronic said:

    I have this code only in one scene that is triggered when global variable ttsMessage change value. In that variable I send message, volume and ID of the Sonos VD on which I want message to be played.

     

    @Sankotronic

    Could you share some code of that "function" that pack and unpack somethings to global variable ? It sounds nice :) 

    Greetings :)

    Link to comment
    Share on other sites

    • 0

    Perhap @Krikroff can help with tips to a few minor problems:

     

    1. I am not able to change radiochanels - it seems that nr 1&2 is working, but not the rest

    2. I am not able to adhust volume

     

    Thank,,,

    Link to comment
    Share on other sites

    • 0
    On 5/11/2017 at 10:17 PM, Sankotronic said:

    I use this service 

    Please login or register to see this link.

     and they have Dutch. You need to make api_key here 

    Please login or register to see this link.

     and then put that api_key in code for Process button on Sonos VD.

     

     

     

    I PAY FOR INSTALLATION. ;-)

     

    I can't get it running... is there someone who can install it on my fibaro installation? I'd pay a little fee.... please contact me with PM if you're interested.

     

    Thanks!

     

    Dan

    Link to comment
    Share on other sites

    • 0
    On 1/6/2019 at 9:59 PM, @jorgei said:

    Perhap @Krikroff can help with tips to a few minor problems:

     

    1. I am not able to change radiochanels - it seems that nr 1&2 is working, but not the rest

    2. I am not able to adhust volume

     

    Thank,,,

     

    it's strange about the volume, information appear in the debug?

     

    1 hour ago, Danielos said:

     

    I PAY FOR INSTALLATION. ;-)

     

    I can't get it running... is there someone who can install it on my fibaro installation? I'd pay a little fee.... please contact me with PM if you're interested.

     

    Thanks!

     

    Dan

     

    what exactly is the problem? And please, do not pay for it !!!

    Link to comment
    Share on other sites

    • 0

    @Krikroff because of your help in the other thread, it works perfect now. :-) 

     

    Unfortunately, there is a big delay in the TTS output. It takes nearly 6-7 seconds, until the text is spoken. Is that normal or is there an option to speed that up? It looks strange that my HUE shows me visually that the alarm system is disarmed but the TTS starts many seconds later. ;-)

     

    Link to comment
    Share on other sites

    • 0
    On 5/17/2017 at 12:33 PM, Labtec said:

    Everything works fine, next is to play a MP3 file from my NAS to my Sonos Play 1, how can I do this?

    actually url path for sonos should be 

     

    Please login or register to see this code.

     

    JFYI: sonos use x-rincon-mp3radio type for playing http(s) stream and x-file-cifs for playing  a local files

    Link to comment
    Share on other sites

    • 0

    Hi Guys,

    At first my compliments it is awesome!!!!

    Its installed and almost excellent.

    The text is comming out of my Sonos>>my wife was surprised to hear my message. Chapeau!!

    Music is a different thing the bells are playing no problem, so the device and scenes are good.

    In my case I changed to time in auto>>>> the bell is still ringing.

    I select a file from my network, if I copy the whole path in explorer it will start to play. That means that the permissions shouild be granted on my network they said to me.

    but Sonos show the titlle but no sound at all.

    If I change HTTP in local still no sound but an error message in my Sonos "Can not play .... file acces denied"!!! I gues I must continiung on this route???

    How I can Sonos player giving acces?

    Note: normaly if Sonos plays music it comes from the same drive in the network.

    I am confused orI am overlooking something.

    Your help is appriciated very much

     

     

     

    Link to comment
    Share on other sites

    • 0

    Hi,

     

    Sorry, I initially put this in another thread, but think it is more appropriate here:

     

    First of all, my sincere thanks to @Krikroff for the VD and a great implementation.

    I have just got my Sonos One, and the TTS is working pretty well. I was wondering if I could find out if it is possible to auto resume the music that was playing (e.g. music from Spotify) before the TTS?

     

    The scene I am using to play the TTS is as follows:

     

    --[[
    %% properties
    %% events
    %% globals
    --]]
     
    ----------- Local variables ------------------
    local _f=fibaro
    local message = "This is a test message.";
    local sid = 445 -- The Sonos ID
    local duration = 15 -- seconds for the speak
    local volume = 40 -- volume for the Sonos
    local bid = 16 -- activate button on the Sonos Virtual Device. Do not change.
    local volume = tonumber(volume)
    local duration = tonumber(duration)
     
    ----------- Do not change anything below -----------
    ----------- or at least only the language code -----
     
    local params = {
         message = message,
         duration = duration, -- 'auto', -- Duration can be: "auto", xx seconds
         language = "en-GB", -- Language: en-GB (This will be in English). Look here for other language codes:

    Please login or register to see this link.


         volume = volume -- Volume
    }
     
    local _x ={root="x_sonos_object",load=function(b)
    local c=_f:getGlobalValue(b.root)
     
    if string.len(c)>0 then
         local d=json.decode(c)
         if d and type(d)=="table" then return d
         else _f:debug("Unable to process data, check variable")
         end
         else _f:debug("No data found!")
    end
    end,set=function(b,e,d)
     
    local f=b:load()
    if f[e] then
         for g,h in pairs(d)do f[e][g]=h
         end
    else f[e]=d
    end
     
    _f:setGlobal(b.root,json.encode(f))
    end,get=function(b,e)
     
    local f=b:load()
    if f and type(f)=="table" then
         for g,h in pairs(f) do
         if tostring(g)==tostring(e or"") then return h
         end
    end
    end
     
    return nil
    end}
     
    -------- Activate Sonos and speak up  ----------------
     
    _x:set(tostring(sid), { tts = params })
    _f:call(sid, "pressButton", bid)
     
    -----------------------------------------------

     

     

     

     Thank-you!

     

    • Like 1
    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.

     Share

    ×
    ×
    • Create New...