Code Monkey home page Code Monkey logo

sonos-controller's People

Contributors

mguntli avatar vmichalak avatar wdoeland avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sonos-controller's Issues

Check if speaker is still online

Sometimes it can happen that a speaker looses connection to the network. Do we have a convenient way to check if a speaker is still online or is the only way to check by trying to get information periodically and catch an Exception if it's offline?

Add Snapshot feature

A snapshot is a copy of the SONOS state at a given point in time and are used to restore it at this particular point in time.
A snapshot feature could be very useful for complex automation scenario (more complex than clip method).

Manage the SONOS event system

Sonos systems have an UPnP pub / sub event system.
This system permit to receive a notification when subscribed service push informations (for exemple: When the volume changes.)

SoCo already have implemented this in python: https://github.com/SoCo/SoCo/blob/master/soco/events.py

On the SONOS forum, a thread talk about it: https://en.community.sonos.com/advanced-setups-229000/upnp-event-subscription-net-c-34484

Specs of UPnP event system (start at page 86) : http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf

Discovers other devices than Sonos

When doing SonosDiscovery.discover(), I can see other devices in the list, not only Sonos. For instance it also finds my Philips Hue bridge.

Example of found Sonos device (uudi removed):
Device{ip='192.168.10.107', descriptionUrl='http://192.168.10.107:1400/xml/device_description.xml', server='Linux UPnP/1.0 Sonos/35.3-37210 (ZPS1)', serviceType='urn:schemas-upnp-org:device:ZonePlayer:1', usn='uuid:RINCON_XXXXXXXXXXXXXXXXX::urn:schemas-upnp-org:device:ZonePlayer:1'}

Example of non-Sonos device, Hue Brigde (uudi removed):
Device{ip='192.168.10.105', descriptionUrl='http://192.168.10.105:80/description.xml', server='Linux/3.14.0 UPnP/1.0 IpBridge/1.16.0', serviceType='upnp:rootdevice', usn='uuid:XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX::upnp:rootdevice'}

I can see you are using SSDPClient.discover(1000, "**urn:schemas-upnp-org:device:ZonePlayer:1**"); when discovering, but doesn't seem to work correct.
I don't know if the issues is in the sonos-controller library or in the SSDP library. Great library anyway, I really enjoy testing all the capabilities!

PS. Sorry to bother you again ;)

PlayUri not working

Hello Vmichalak,
Thanks for such a great library.
I am successfully able to perform operation like as pause,play from android app to sonos.
But when i tried with method playUri(String uri,String meta) it 's giving me UPnPSonosControllerException. How can i overcome this error.
Also I want to achieve below functionality,
Stop currently playing song on sonos device, play my announcement(from app) on sonos and resume previously running song if it was running from other devices like as Sonos Controller. Will it be possible to achieve this from your code?

Sonos UPnP Error 701 (Invalid transition)

I'm trying to play mp4 file with Sonos-Sontroller:

List<SonosDevice> devices = SonosDiscovery.discover();
SonosDevice device = devices.get(0);
String test = "http://213.8.5.155/videoplayback2.mp4";
device.clip(test,"player");

With that code is playing the file perfectly.

When i try to open HTTP server on the phone and use the same code with:
String test = "http://192.168.0.103:4020/get-video/test.mp4";

I always get this error:
Sonos.exception.UPnPSonosControllerException: UPnP Error 701 (Invalid transition) received from 192.168.0.102

This server is local HTTP server open on the application when i tried to access it from my pc he plays the song perfectly.

IllegalStateException at com.vmichalak.sonoscontroller.ParserHelper.findOne(ParserHelper.java:11)

While doing "getZoneName()" on a "SonosDevice" object I get the following:

(...)
java.lang.IllegalStateException: No successful match so far
                      at java.util.regex.Matcher.ensureMatch(Matcher.java:471)
                      at java.util.regex.Matcher.group(Matcher.java:578)
                      at com.vmichalak.sonoscontroller.ParserHelper.findOne(ParserHelper.java:11)
                      at com.vmichalak.sonoscontroller.SonosDevice.getSpeakerInfo(SonosDevice.java:463)
                      at com.vmichalak.sonoscontroller.SonosDevice.getZoneName(SonosDevice.java:373)
                      (...)

"String regex" in findOne contents:
<ZoneName>(.*)</ZoneName>

"String content" in findOne contents (SerialNumber, MACAddress and CutomerID removed):

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="/xml/review.xsl"?><ZPSupportInfo><ZPInfo><ZoneName>0. Køkken</ZoneName><ZoneIcon>x-rincon-roomicon:kitchen</ZoneIcon><Configuration>1</Configuration><LocalUID>RINCON_B8E937568F5A01400</LocalUID><SerialNumber>XX-XX-XX-XX-XX-XX:0</SerialNumber><SoftwareVersion>35.3-37210</SoftwareVersion><SoftwareDate>2017-01-21 22:51:23.323408</SoftwareDate><SoftwareScm>296936</SoftwareScm><MinCompatibleVersion>34.0-00000</MinCompatibleVersion><LegacyCompatibleVersion>25.0-00000</LegacyCompatibleVersion><HardwareVersion>1.8.3.7-2</HardwareVersion><DspVersion>0.25.3</DspVersion><HwFlags>0x0</HwFlags><HwFeatures>0x0</HwFeatures><Variant>0</Variant><GeneralFlags>0x0</GeneralFlags><IPAddress>192.168.10.110</IPAddress><MACAddress>XX-XX-XX-XX-XX-XX</MACAddress><Copyright>© 2003-2017, Sonos, Inc. All rights reserved.</Copyright><ExtraInfo>OTP: </ExtraInfo><HTAudioInCode>0</HTAudioInCode><IdxTrk></IdxTrk><MDP2Ver>0</MDP2Ver><MDP3Ver>0</MDP3Ver><RegState>3</RegState><CustomerID>XXXX</CustomerID></ZPInfo></ZPSupportInfo>

I'm new to GitHub and Java, so let me know if you need anything else!

Android Studio 3.0.1. Unable to merge dex

Hello, i use android studio 3.0.1 version. add your sonos module in my project. but i get this error.
Why i get this error. Thank you so much for help.

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

Inconsistent discovery

I'm running the following code:

List<SonosDevice> devices = SonosDiscovery.discover();
for (SonosDevice device : devices)
{
    SonosSpeakerInfo speakerInfo = device.getSpeakerInfo();
    System.out.println("Found speaker at " + speakerInfo.getIpAddress() + ": " + speakerInfo.getZoneName());
}

I get different results every time I run it. Four examples:

Found speaker at 192.168.1.10: A
Found speaker at 192.168.1.11: B
Found speaker at 192.168.1.12: C
Found speaker at 192.168.1.13: D
Found speaker at 192.168.1.12: C
Found speaker at 192.168.1.11: B
Found speaker at 192.168.1.10: A
Found speaker at 192.168.1.13: D
Found speaker at 192.168.1.12: C
Found speaker at 192.168.1.10: A
Found speaker at 192.168.9.10: A
Found speaker at 192.168.9.13: D

As you can see, I'm not always getting all devices. Do you know what the reason of this could be?

Identify coordinator of a group

Hi Valentin

Great library - looking forward to your future extensions!
In order to play music in a stereo pair, I need to find the coordinator which I can send the playUri command. Any hints how I can accomplish this?

My first attempt was to loop through the list, compare the zone name and find the one where "isJoined" returns false. However this does not seem to work when a pair of speakers is linked together as stereo pair.

Example:

  • Living Room (L)
  • Living Room (R) --> coordinator

Ability to load/save playlists

It would be great to be able to save queue to a playlist, load playlist list, load playlist into a queue, load playlist as show queue

SonosDevice::getZoneName is actually SonosDevice::getRoomName

As far as I understood the Sonos system, every speaker can have a name.
Example with three speakers:

  • Living Room (Living Room L + Living Room R joined as stereo pair)
  • Bedroom

A) GetZoneGroupAttributes / CurrentZoneGroupName
If all three speakers are joined together, the "CurrentZoneGroupName" returns "Living Room + 1".

B) http://sonosip:1400/status/zp

  • Living Room L
  • Living Room R
  • Bedroom

C) http://sonosip:1400/device_description.xml

  • Living Room
  • Living Room
  • Bedroom

Proposal:
Rename "getZoneName" to "getRoomName", get the room name from device_description.xml

Stream music directly to device

It would be great if we could directly stream music to the speaker. I currently do this by hosting a web server, pushing the file to a folder available on the network and supplying the correct URI to the speaker. This is a bit inconvenient and we should also be able to stream directly from our program to the speaker. Imitating a radio station by UDP or HTML streaming which can then be played back.

SonosDevice.getIpAddress()

Could we expose the IP address of a device? I can get the address from SonosDevice.getSpeakerInfo();, but if that fails there is no good way of knowing. The IP address is rendered in toString(), so I think we might as well expose the address directly?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.