I have a Sonos audio system installed that I have now integrated with my Homeseer ZS2 home controller. All of that works fine in that I can control the Sonos system (as well as my lights) through the Homeseer system on the PC. I have just now added an Amazon Echo to the mix. The Echo lets me control the lights through the Homeseer, but the Echo does not or can not see any of the five Sonos speakers that are available; therefore, the Echo can NOT control any of the Sonos Speakers. What else do I need to know, or do, in order to get my Echo to Sonos integration to work?
Announcement
Collapse
No announcement yet.
Echo to Sonos Integration
Collapse
X
-
JeffSDavisTags: None
-
Originally posted by JeffSDavis View PostI have a Sonos audio system installed that I have now integrated with my Homeseer ZS2 home controller. All of that works fine in that I can control the Sonos system (as well as my lights) through the Homeseer system on the PC. I have just now added an Amazon Echo to the mix. The Echo lets me control the lights through the Homeseer, but the Echo does not or can not see any of the five Sonos speakers that are available; therefore, the Echo can NOT control any of the Sonos Speakers. What else do I need to know, or do, in order to get my Echo to Sonos integration to work?
Dirk
-
I added the ability to have Alexa/Echo control the volume of my wife's Sonos using a Virtual Device and a script. I'll try to provide all the "lessons learned" that I can remember. I'm using the HomeSeer Echo API, not the skills.
First, as you may have read in other forums, the Amazon system severely limits the HomeSeer devices it "recognizes"; Alexa did not recognize any of the Sonos devices. So in many cases you'll need to create Virtual devices that Alexa (the Amazon software) will recognize. That pretty much means, from what I've experienced, devices that are straight on/off or look like a light dimmer. I created a virtual device named "Sonos Loudness" with Status text of: on, off and range of 1 to 99 (again, just like a light dimmer).
Why "Sonos Loudness" instead of "Sonos Volume" as the name of the Virtual Device? Because no matter what I tried that had "volume" as part of the device name, Alexa would associate my voice command to its' own internal music player volume (it would also say if I tried to command a volume setting greater than 10, that the volume could only be adjusted between 0 and 10). With that figured out, the command I speak is "Alexa, set Sonos Volume to 40", or any other value between 0 and 100.
The next thing is to tie the change in the value of the Virtual Device to the actual Sonos Volume. For this you need an Event and a script that is called by the Event.
The Event looks for any change in the value of the "Sonos Volume" Virtual Device - if that change does it occur, then it runs the script 'SetSonosVolume.cs'. The script doesn't get passed any parameters - it just gets the current value of the Virtual Device and sets the REAL Sonos Volume to that value. Here's the script code, written in C#:
Code:using System; using HomeSeerAPI; public object Main(object[] Parms) { int exitCode = 0; int newVolume = 0; int devRef = 376; // This script does not use passed parameters - instead, it uses the value of a Virtual Status device named // "Sonos Volume", which has Reference ID = 376. newVolume = hs.DeviceValue(devRef); // Execute the HomeSeer CAPI commands to fetch the volume value and then set it to the parameter passed to the script. HomeSeerAPI.CAPI.CAPIControl cc = hs.CAPIGetSingleControl(hs.GetDeviceRefByName("Sonos Beck's Volume"), true, "Volume (value)%", false, false); cc.ControlValue = newVolume; HomeSeerAPI.CAPI.CAPIControlResponse cr = hs.CAPIControlHandler(cc); // Wrap up -- Write to the log - that the Sonos had it's volume set/changed. hs.WriteLog("SetSonosVolume", "Set volume of Beck's Sonos to " + newVolume ); return exitCode; }
Regards,
BBB
Comment
-
Originally posted by ideaguy View PostI'm trying to do the same thing but struggling to get it working. Can you explain a bit more how you are setting this up and getting Echo to respond?
Thanks
Z
Comment
-
Originally posted by ideaguy View Postvasrc - I'm a newbie. Can you explain how you set this up as an event that works with Echo?
For EasyTrigger you need to install the plugin (it's free for 30? days then you would need to purchase it). It's like the swiss army knife of Event actions
If the virtual device part:
Create a new device from the Home page (Green +)
Goto the Status Graphics tab and delete the two existing On/Off items
Create a new range and set it to 0 - 100
Set the Control Use: to "Dim"
The "Voice Command" should already be set for new devices.
Create a new Event
It will contain a simple Trigger of: IF "new virtual device name" had it's Value set or changed
and the Action:
EasyTrigger Set Device to another Device "new virtual device name" to "Sonos Volume name"
Then you let Echo discover the new device (Alexa discover new devices)
You should then be able to say:
Alexa, set "New device name" to X %
I did get Sonos Volume to work, but as BBB said, it's probably best to use something else as Echo does have some words it's partial to for itself.
There should be several more detailed explanations available about setting up devices and events. Look in the How-Tos section.
Z
Comment
Comment