Calling Sonos users

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
laserchris
Member
Posts: 7
Joined: Sun Jan 27, 2008 4:51 pm

Post by laserchris »

ok , so I worked out the ids of my ZP. I get the following error:
Source:"microsoft vbscript runtime error'
File "c:program files\housebot\config\scripts\zoneplayer_device_1.04.1.vbs line 309 char:1
error:0 'Type misatch: 'CBool"
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

Cut and paste to Notepad then save with a .vbs extension.

Code: Select all

Dim ZonePlayerFinder
Dim ZoneInfo
Dim ZoneCount
Dim fso
Dim File
Dim I

Set ZonePlayerFinder = CreateObject("ZonePlayer.Finder")

ZonePlayerFinder.FindZonePlayers
ZoneInfo = ZonePlayerFinder.GetZoneInfo
ZoneCount = ZonePlayerFinder.GetZoneCount

Set ZonePlayerFinder = Nothing

Set fso = CreateObject("Scripting.FileSystemObject")
Set File = fso.OpenTextFile("c:\UniqueDeviceNames.txt", 2, True)
For I = 0 To (ZoneCount - 1)
	File.Write(ZoneInfo(I,0) & ": " & ZoneInfo(I,1) & vbCRLF)
Next
File.Close
Set File = Nothing
Set fso = Nothing
Precisely which .hbx file did you import? Do not use the one in the very first post (i need to clean this up a bit). Use the most recently posted version as some property values that were initially alphanumeric have been changed to boolean. Also, use script 1.04.1a as it will suppress these errors and log them to HouseBot.

Also, did you right-click the .wsc file and register it?

Osler
laserchris
Member
Posts: 7
Joined: Sun Jan 27, 2008 4:51 pm

Post by laserchris »

ahh ok , i have updated to the latest hrx file. Get a different error:

with script ZonePlayer_Device_1.04.1

error 0: 'wrong number of arguements or invalid property assignment: 'ZonePlayer.GetVolumeLevel"

if i use version ZonePlayer_Device_1.04.1a
line 184 char 18
errot:0 'expected statement'
if Err <0> then then
laserchris
Member
Posts: 7
Joined: Sun Jan 27, 2008 4:51 pm

Post by laserchris »

ok so i removed all the duplicate then then .

Have the controller kind of working, it launches and I can control volume play/pause for what is streaming currently in one zone. When I try to browse music, I get the option to select album or artist or folder etc. However when I click on each option I cant get any futhur. no error messages just doesnt go any futhur.. any ideas?
laserchris
Member
Posts: 7
Joined: Sun Jan 27, 2008 4:51 pm

Post by laserchris »

apologies , I should double check before entering things.. all seems to be working. Will test and update you on my findings.

thanks for your help

Chris
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

No...my apologies. This is not a simple thing to get working for someone new to HouseBot. I will try to get together a simple step-by-step installation procedure to make it a bit less painful.

One of the things you will not get with the imported properties is acceptable values (as displayed in the beginning of the script). You will have to manually set these by editing the property itself and inputing the allowed/available values (i.e., ZPTransportState has values of Play, Pause, Stop, Next, Previous). Once you do this, when you click on that property value in the device it will give you a drop-down list of values to choose from (as the boolean values do by default - 0 or 1).

I would recommend you play with the devices a bit before moving on to theme editing/construction. Also, set some initial goals for your control needs and get those devices set prior to attempting a theme (i.e., sonos, TV, cable/sat box, receiver, thermostat).

Osler
laserchris
Member
Posts: 7
Joined: Sun Jan 27, 2008 4:51 pm

Post by laserchris »

hi , i seem to have everything working for all 3 zones... only thing is that the graphics dont tie in exactly as I have a zone called Study which you dont have. No big issue. I am a bit confused by your last post, have I missed something in that I seem to have everything working? Also I want to use this on my nokia n800 which rdp software do you use?

How do i add a 4th zone? I need to create the device but am not sure how to from scratch.

this looks to be an excellent product !! tanks for all your help

chris
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

You have not missed a thing, it seems!! My comment was more for others who may want to try to set this up but are hesitant to pull the trigger due to the steep learning curve with HB for some things. A set of instructions would make things a bit easier. The acceptable values I talked about are not a prerequisite for things to work....they simply make device control and theme construction a bit easier because you get drop-down menus to select values from (see Settings -> Property Manager).

To add a 4th zone export one of your ZP devices and then import that export back into HB. This will place another ZP device in your device list which you can rename as you like.

rdesktop from maemo.org

Osler
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

Please see the first post for the most current version of the script device. Included in the zip file are the following:

1. Latest script (1.04.1a - with Then Then problem fixed)
2. UniqueDeviceNames script
3. ZonePlayerController.wsc
4. ZonePlayerFinder.wsc
5. hbx for 800x480 theme import with 3 zones
6. hbx for single device import (i.e., no theme or tasks are imported...device only)
7. latest SonosHH Images folder for the theme
8. Something resembling a manual.

Osler
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

New Features

Post by Osler »

See first post for download.

Added Features:

1. "Magic" songs

You can now add "magic" songs to your sonos shares that HouseBot can interpret as control messages originating from the Sonos handheld controller. Included are some sample .mp3 files that you can adjust to your needs. When one of these songs is added to the queue, HouseBot will see the addition, pass the message associated with that addition to a device property, and then delete the song from the queue. You can use a task to parse the messages and perform functions as needed. A message consists of the Artist information concatenated with the Title information (<Artist - Title>). In the example songs, the Album is *Media Control and the Artist is *Family Room. The title gives the precise command to execute for Family Room (i.e., +TV On, +Receiver On, +Receiver Volume Up, etc.). Note that the asterix is stripped from the message prior to passing to HouseBot (adding +TV On by artist *Family Room to the queue would pass the message Family Room - TV On to HouseBot).

To edit the sample .mp3 files to your needs, simply right-click, select summary, choose advanced, and edit the Album, Artist, Title information. The Title must be preceded by a + for the script to recognize it as a command. The asterix is used to insure these special songs appear at the top of the music library when viewed in the Sonos handheld controller. I would recommend grouping functionality by Album (i.e., lighting, AV control, etc.) and grouping areas of control by Artist (i.e., pool, bedroom, etc.).

Once you have your songs edited, place the folder within you Music folder and reindex your music (via handheld controller, desktop controller, or see below).

Required Property:

ZPHHMessage (alphanumeric)

2. Reindex Music

This will allow you to perform a music reindex from within HouseBot.

Required Properties:

ZPReindexMusic (boolean)
ZPIndexType (alphanumeric - this can be either ALBUM or ALBUMARTIST)

3. Ramp To Volume

This allows you to perform a slow increase or decrease in volume. By placing an integer from 0-100 in the property, the zone player will make a slow transition to that volume.

Required Property:

ZPRampToVolume (alphanumeric)

4. Restore Volume Prior to Ramp

A simple boolean that, when True, will restore the volume of the zone player to what it was prior to performing a volume ramp.

Required Property:

ZPRestorePreRampVolume (boolean)

Additional minor fixes are included:
-now displays [no music] when no music is selected for a zone
-track length and track position will not be displayed if no track is selected or internet radio is selected
-fixed an issue where the device was unable to track changes in playmode

Osler
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Sending Data for Display to the Sonos Handheld Controller

Post by Osler »

Some have asked about being able to display non-Sonos related information on the Sonos handheld controller. This is something I am not terribly interested in; however, I have come up with a workable solution. You will need to have a unique .mp3 file for each piece of data you want to display. Each of these files should have a unique Album and Artist. For instance, Album = Information and Artist = Weather, News, etc. The title of the .mp3 would contain the relevant information to be displayed. To get to the information, simply navigate the music menu. As with magic songs, I would recommend using some type of prefix to the Album and Artist name. A + could be used and would segregate these to the top of the music menu list and separate from the magic songs (see prior post). Use the following script in a separate script device to pull information from your other HouseBot devices and populate the ID3 tags of the appropriate songs. In the example, you would need a file entitled CurrentTemp.mp3 and CurrentConditions.mp3. The script will open these .mp3 files and populate the Title of the ID3 tag with a property value from within HouseBot (you will need to edit the script to do this). The final action of the script should be set with one of your ZonePlayer device names so a reindex can be performed to update the Sonos system with the new tags. The only property value that needs to be added to the script device is MusicPath (or you can simply hardcode this into the script). The .dll used in the script is included in the .zip file attached.

Code: Select all

Option Explicit

Dim Tag
Dim MusicPath

Set Tag = CreateObject("CDDBControl.CddbID3Tag")
MusicPath = GetPropertyValue(".MusicPath")

Tag.LoadFromFile MusicPath & "CurrentTemp.mp3", False
Tag.Title = "+Current Temperature: " & GetPropertyValue("<insert here>")
Tag.SaveToFile MusicPath & "CurrentTemp.mp3"

Tag.LoadFromFile MusicPaht & "CurrentConditions.mp3", False
Tag.Tile = "+Current Conditions: & GetPropertyValue("<insert here>")
Tag.SaveToFile MusicPath & "CurrentConditions.mp3"

Call SetPropertyValue("ZP_<insert here>.ZPReindexMusic", 1)

Set Tag = Nothing
Enjoy.

Osler
Attachments
CDDBControl.zip
(259.59 KiB) Downloaded 232 times
CouchPotatoe
Senior Member
Posts: 103
Joined: Sun Jul 31, 2005 2:43 pm
Location: Yorkshire UK

Post by CouchPotatoe »

Hi,

Lots to play with here - looking forward to it :-)

I have a question on the status display aspect. From reading above it seems that the new status will not be available until the re-index has completed. Even though only one track may have changed meta data I think my re-index takes a very long time still. (I'm over the 30K track limit). I'm guessing there's no way to force a ZP to just refresh one tracks meta data is there ? I'm hoping for a near realtime status display in some way...and yes, I still believe in Santa Claus too !

Alternatively is there any meta data that is read from the track each time it is displayed rather than stored internally in the ZP's ? Again I suspect it's only the less useful/awkward non textual data like the cover artwork though. Maybe there is some more responsive state display with an ON|OFF jpeg (that dynamically replaces the coverart) that could be employed. OTOH maybe that gets cached though.

Anyway before I surmise too much let me have a play and see how it works...

K
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

CP:

I am not aware of a way to inform the ZP that a single track has changed and update it. At this point, this is the only workable solution I can think of. I understand that a large library will take a while to reindex....you'll have to drop the frequency of updates to cope with this. Real-time updates is a problem.

There is a separate function exposed by the ZP to reindex internet radio. This may be workable but I haven't delved into how to add internet radio stations to a ZP programmatically. The reindex for this should be much quicker than for a music library.

I'm pretty sure album art is stored internal to the ZP. If album art isn't, then its use to display data is possible. This then becomes a question of how to actually display this on the HH controller without interrupting playback.

Osler

EDIT: Just thinking about this, there may be a way to directly edit the object data on the ZP. If so, a single reindex would put the dummy songs in play and then their data MAY be editable via the script. I will have to play with this a bit.
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

See first post for updated files. Changes have been made to insure HB maintains its connection to the ZonePlayer, even in the event of a brief network failure.

Osler
sseiber
Member
Posts: 1
Joined: Sun Mar 30, 2008 11:21 pm

Mac compat

Post by sseiber »

I stumbled across this info while looking for UPNP samples talking to Sonos. Nice Work!

I can't wait to play around with this COM lib with my home system. It looks like a nicely rolled up library of features specific for Sonos abstracted away from UPNP.

Question:
I'm also dabbling with iPhone/iTouch. Is there anything like your library available for the Mac OS X platform?
Post Reply