Tag Archive: Sonos


I wrote another little shell script / python script to pull the status & current playing track name:

import xml.etree.cElementTree as XML import requests endpoint = '/MediaRenderer/AVTransport/Control' action = '"urn:schemas-upnp-org:service:AVTransport:1#GetTransportInfo"' body = '<u:GetTransportInfo xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><Channel>Master</Channel></u:GetTransportInfo>' headers = { 'Content-Type': 'text/xml', 'SOAPACTION': action } soap = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>' + body + '</s:Body></s:Envelope>' r = requests.post('http://192.168.0.218:1400' + endpoint, data=soap, headers=headers) dom = XML.fromstring(r.content) print dom.findtext('.//CurrentTransportState') action = '"urn:schemas-upnp-org:service:AVTransport:1#GetPositionInfo"' body = '<u:GetPositionInfo xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><Channel>Master</Channel></u:GetPositionInfo>' headers = { 'Content-Type': 'text/xml', 'SOAPACTION': action } soap = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>' + body + '</s:Body></s:Envelope>' r = requests.post('http://192.168.0.218:1400' + endpoint, data=soap, headers=headers) dom = XML.fromstring(r.content) track = {} import re print re.search('<dc:title>(.*)</dc:title>', dom.findtext('.//TrackMetaData'), re.IGNORECASE).group(1)

See:

I also got lighttpd & php5 up and running on my raspberry pi running domotiga so I can access the web interface:

Now I’m trying to get the 433Mhz door/window sensors connected but first I need to work out how to decode the rf packets. I tapped into my jeelabs 433Mhz ook plug and built a circuit similar to that described here: http://wiki.nethome.nu/doku.php/analyzer/hardware

I didn’t have all the right bits handy but it worked regardless!

After doing some captures in Protcol Analyzer I think I have determined the pulse width to be around 1500μs:

But I’m still at a bit of a loss how to then decode (I’m hoping I can somehow separate each "data packet" then compare packets origination from two different sensors) then work out which bit relates to the "house code" etc

Here’s a sample of the hex data:

Door Sensor #1

0000 0067 0000 0019 0017 003b 0040 0012 0040 0012 0040 0012 0017 003b 0040 0012 0017 003b 0016 003b 0017 003b 0040 0012 0040 0012 0040 0013 0016 003b 0040 0012 0017 003b 0040 0012 0016 003c 003f 0013 0016 003b 0040 0013 003f 0013 003f 0013 0016 003c 0016 003b 0016 0279

0000 0067 0000 0019 0016 003b 0040 0012 0040 0011 0040 0012 0017 003a 0040 0011 0018 003a 0016 003b 0018 003a 0040 0011 0040 0013 0040 0011 0018 003a 0040 0012 0016 003c 003f 0013 0016 003b 0040 0012 0016 003c 003f 0012 0040 0013 003f 0013 0016 003c 0016 003b 0016 0279

0000 0067 0000 0019 0018 0039 0041 0010 0040 0011 0040 0011 0018 003a 0040 0010 001a 0038 0019 0038 001a 0037 0042 000f 0040 0012 0040 0012 0017 003a 0040 0011 0017 003b 0040 0012 0017 003a 0040 0012 0017 003a 0040 0011 0040 0012 0040 0012 0017 003b 0016 003b 0017 0277

Door Sensor #2

0000 0067 0000 0019 0016 0038 003b 0010 0016 0039 0016 0038 0016 0038 003a 0011 0016 0039 0016 0038 0016 0038 003a 0011 003a 0011 003a 0011 0016 0038 003a 0011 0016 0039 0039 0011 0016 0039 0039 0012 0015 0039 0039 0012 0039 0012 0039 0012 0015 0039 0015 0039 0016 0265

0000 0067 0000 0019 0016 0038 003a 0011 0016 0038 0016 0038 0016 0039 003a 0010 0016 0039 0016 0038 0016 0038 003a 0011 003a 0011 003a 0011 0016 0038 003a 0011 0016 0038 003a 0011 0016 0039 0039 0012 0015 0039 0039 0012 0039 0012 0039 0011 0016 0039 0015 0039 0015 0266

0000 0067 0000 0019 0016 0038 003a 0011 0016 0038 0016 0038 0016 0039 003a 0011 0015 0039 0016 0038 0016 0039 0039 0011 003a 0011 003a 0011 0016 0039 0039 0011 0016 0039 0039 0012 0015 0039 0039 0012 0015 0039 0039 0012 0039 0012 0039 0012 0015 0039 0015 0039 0016 0265

L

Advertisements

I have been making a lot of changes the network recently so thought it was time to sketch it out:

The left hand stack is housed in the A/V rack/closet and the right stack is housed in the garage rack. To clarify a few points:

  • The two switches are linked using a 2 x 1 gigabit fibre trunk
  • The ESX servers and file servers are connected to the switch using 2 x 1 gigabit ethernet trunks
  • There ET9000, XBMC, Apple TV 2, HDMI Matrix and Sonos devices can all be controlled from smartphones, pcs etc
  • The ET9000 records to the file server
  • The Sonos Connect / ZonePlayer 90 is connected to the Onkyo Amp to allow Sonos to output to my home theatre
  • The Sonos Connect / ZonePlayer 90 is connected to the Apple TV to allow streaming from iTunes/iOS devices to all zones
  • I haven’t bothered to include my router, wireless access points, client pcs, smartphones, printers and various other devices in the diagram

The wireless sensor network provides:

  • Whole house power consumption currently using a CurrentCost EnviR
  • Individual appliance power consumption (currently monitoring 6 appliances using CurrentCost IAMs)
  • Environment information (temperature, light, humidity) using Jeelabs Jeenodes in multiple zones

This is a good reference point for where I’m headed (not much progress since I last listed but alas, still the way forward):

  • Further appliance monitoring and more importantly control (potentially through upcoming project/device: HexaBus – https://github.com/mysmartgrid/hexabus/wiki or plugwise – http://www.plugwise.com/idplugtype-g/)
  • Security cameras (and doorbell integration)
  • Environmental information (I have pulse counters for my gas meter and water/central heating system that need installing)
  • XBMC hardware replacement (once the Raspberry Pi – http://www.raspberrypi.org/ is available to buy I’d like to replace my Acer Revo)
  • Home Automation Hub replacement (once the Raspberry Pi is available to buy I’d like to try Domitiga – http://www.domotiga.nl/ or my own custom solution)
  • Web Interface (to bring all of the information together from the wireless sensor network, along with the state of all network devices (from bandwidth to free space etc) and most importantly allow central control- so instead of me having to use different methods to switch on the ET9000, change the channel on the HDMI matrix, power on the amp etc, I can do it all with one button)

As usual- I imagine I’ve missed a few bits out from the above but it hopefully provides a good overview of my network.

L

Further to my earlier post: https://tickett.wordpress.com/2012/01/21/sonos-up-and-runnings-ish/ I have now received the Sonos Connect (ZP90) and have now solved issue #1 (stream to both Sonos S5 / Play 5 devices and my living room Onkyo TX-SR608 amp simultaneously) but issue #2 is still outstanding (streaming from the Onkyo TX-SR608 to the Sonos devices).

The problem is the lack of analog audio outputs on the Onkyo amp. Strictly speaking there are 2 sets of analog outputs on the amp: Zone 2 and VCR/DVR but they only work if the input is analogue (which in most cases it is not).

As the main device I’d want to send audio from the amp to the Sonos devices is my AppleTV 2 I think I will probably buy a Digital Optical to Analog RCA audio convertor (£20 off eBay)- this is also the more energy efficient solution as the amp won’t have to be powered to feed the ZP90. Unfortunately this will leave me unable to stream audio from the sky box, htpc etc but it’s unlikely I’d ever want to do that anyway…

L

Sonos up and running… ish

A month back there was a special offer on a package comprising 2x Sonos Play 5 (or S5) and 1x Sonos Bridge- so I decided to see what all the fuss was about. After a rather painful wait for stock I finally took delivery of the units.

I have to admit I’m pretty impressed. Setup was an absolute breeze- all 3 devices in no more than 5 minutes. Within 15 minutes I’d updated the firmware on all the devices and tested most of the functionality.

As I’m trying to be conscious of my energy consumption I did a little analysis… The Sonos Play 5 uses approx 9W whilst idle, then between 14W (low volume) and 21W (full volume) whilst in use. I find the idle figure to be a little higher than I’d’ve hoped, but the active figure isn’t bad.

I have several issues with what I’m now left with:

1) Whilst I can stream to both S5 devices simultaneously, I cannot simultaneously stream the same source to my living room a/v equipment (onkyo amp). To address this drawback I’ve ordered a Sonos Connect (Zone Player or ZP90)
2) I cannot stream from my devices like I’m used to with airplay / appletv. I’m thinking of potential solutions for this… I could go from appletv -> amp -> connect but that’s a bit wasteful. I could also purchase 1 (or more) airport express devices but again, that seems rather wasteful. I read somewhere that Sonos released the API / documentation for streaming to their devices, so I guess I’m hoping there is already a better solution out there?

As always- I’ll do my best to keep you posted.

L

A few small updates

A few small updates as I have a ton of projects on the go at the moment.

FreeNas 8

After a friend visited earlier in the week I decided to give FreeNas / ZFS another shot- so I’ve installed the latest v8 on a spare HP Microserver N36L. The little cube has 4x 1.5TB Samsung disks in RAID-Z with a single 4GB stick of RAM. I have ordered another stick of RAM and a low profile, dual-port, gigabit pci-e network interface card (nic)- the HP NC360T (intel chipset) so I can setup load-balancing/link aggregation/LACP. I starting copying some data off of the current production Microserver (WHS2011):

Performance seems average. I’d expect to see a bit of an improvement when the gigabit HP / Intel nics arrive.

New Orders :)

I have put my Cisco SGE2000P 24-Port Gigabit managed PoE switch up on eBay as it’s a bit too big and loud for the small data/comms cabinet I bought recently. As a replacement I have ordered the D-Link DGS-1224TP which appears to offer the same feature set at half the size and half the weight (I think it may also be passively cooled and is touted as being "green" so hopefully help with the leccy bill :)

I also have a few Sonos S5 network wireless hifis on order (they were on special offer and I’ve been looking at whole house / multi-room audio distribution solutions for a while). I have a slight concern I may need to buy some Apple AirPort Express access points to enable AirPlay on them but I’ll cross that bridge as/when…

Apple Programming

I’m learning xcode / cocoa / objective-c / osx / iOS whatever they call it as I want to write a little app to control my 4×4 HDMI matrix. The device is on the network and supports simple commands using a telnet style socket connection, so I’m hoping it won’t be too tricky! Unfortunately I couldn’t find the old control software I had or documentation but eventually stumbled upon the pdf with a few pointers. So the reading begins… http://developer.apple.com/library/mac/#referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/_index.html#//apple_ref/doc/uid/TP40007594

L

%d bloggers like this: