Friday, January 18, 2008

Network events from the BBSB controller!

Great news on the BBSB Online controller front -How to get controller events on your local Lan - something that has been a bit of a mystery to us.

Reader Marcus J has posted a comment on my earlier BBSB Online Review about how he set about writing his own software to control the BBSB controller device locally on his LAN. - While we'd already discovered how to 'control devices' by talking direct to the controller, he's cracked the event notification side which is even more useful , as the subscription BBSB online software which is currently able to send e-mails and Texts on events, but nothing that is extensible for those of us who want the events to go to our own apps and scripts.

Here's how:

Using a network packet analyser he discovered that whenever the device detects a RF signal it broadcasts a UDP packet to the broadcast IP of with destination port of 53003 and the packet data is in format of "devicecommand:1e01:" for example where e1 has been turned on.

All you do is write a script or application to listen for udp broadcast packets on port 53003. :)

Marcus tells me this has enabled him to write his own macros to trigger other devices /emails/alerts etc whenever an event occurs.

He has also written a script plus php web front end to allow control of devices using a schedule all thanks to our earlier discovery on the URL format.

The script simply opens port 80 on the device and sends the necessary http header and url when a scheduled event occurs.
If this was facebook, I'd have bought you a virtual Pint Marcus! - well done.
If anyone else has any clever ways of making use of this little controller, feel free to let us all know using the comments link below.
Yup, it's true - works like a charm - here's an updated SleepTool.exe, that can hear BBSB events from the controller on the network. It also has a simple way of mapping BBSB devices (switches, motion detectors - etc ) to executing stuff on your host PC so you can run an app when a detector is triggered etc - link to the code and binary. - Enjoy. (standard horrid-vb coding disclaimer applies 8-) ) - you can use this on multiple PC's to put them to sleep when you turn off the power, the app still supports all the functions of the previous version.
Also, when the controller is instructed by the BBSB website to turn on/off a device, Marcus's observation also applies - so a local packet with 'devicecommand:0A01:' is seen when the website turns off Device A1 for example. Finally, there looks to be some sort of heartbeat packet as well every 10-20 seconds, which contains all sorts of interesting stuff when the controller heart-beats to the BBSB mothership....

Sunday, January 13, 2008

Does your Media Center sleep through the night?

Mine does, but initially not the way I wanted it to.. so:

You'll all know that you can set the power management settings in Vista, and MCE2005 to Sleep/Hibernate your MCE PC when it's not being used, but this doesnt take account of 'fixed time events', like when you go to bed at night for example, and doesnt ensure that the MCE machine is 'awake' when you want it to be - like when you sit down to watch TV in the evening - of course if you have the right type of BIOS and motherboard you can wake it with the MCE remote..

Enter 'SleepTool' , another VB app, that this time is based on an excellent code sample from
coder iPrank on (post is here).

I've added a few lines of code to make it accept command line parameters, but essentially it's all his work - nicely done.
So, I now have a scheduled task on the PC at the time I go to bed in the evening that says:

SleepTool sleep 17:30

This sleeps the PC immediatley (unless it's recording!) and wakes it up ready for me when I sit down to watch TV in the evening. (If the machine is recording or playing the sleep request is over-ridden by MCE and the request has no effect)

You can also tell the machine to 'hibernate' by swapping 'sleep' on the command line for 'hibernate', and use a relative time from the sleep point - so

SleepTool Hibernate 300

will hibernate the PC for 5 hours from 'now'.

Hope this is of use to someone 8-)

A Little Home-Automation side-note. Our Domia Lite controller has had a firmware upgrade, and sadly has lost the ability for me to 'sniff' the events on the controller from it's local web-server. I currently have another nasty VB app called PingAction.exe (source/binary here if you want it), that I use on a scheduled event every 10 minutes - this pings the IP of my Slim Squeezebox and uses this to 'deduce' if I've gone to bed for the night or not (I turn off the Slim with the ByeBye Standby 'green switch' (See earlier blog post) - this is a very nasty crude way of 'telling' if I'm no longer wanting media center to be on - and the application then invokes the SleepTool to put it to sleep.

Domia (if you're reading) - this is plea for some public API's to your excellent web-based HA system and/or the controller itself- its great , but I'd love to be able to actually integrate some other software with it - currently I cant work out any other way! -- am I missing something?


Wednesday, January 02, 2008

A critical Media Center process has failed

I dont usually rant on here, but this one has got me all annoyed.

My Vista Media Center machine has been in 'production' in the house for a good 5 months now, and apart from a few annoyances (see below), it's been relativley plain sailing.

Until the christmas hols that is:

  • Just when it was time to book in all the rubbish xmas TV recordings over the festive season, I got the ominous 'A critical Media Center process has failed' message.

If you search on the GreenButton, and other popular forums, you'll pretty much see that people are tearing their hair out on this one - everything from new motherboards to repeated rebuilds to try and get rid of it.

Now, being from a SW engineering background, I'm not sure who in the ivory tower decided it was a good idea to present this as a modal dialog to the end-user on the 10-foot interface, rather than log something useful in the event logs, or even (gasp) 'report' the issue and get a fix for it, but here is story from my perspective, and what it led to:

  • Recordings.xml was about 1.5MB, and had about 2 years worth of series recordings, in fact it was moved over from the MCE2005 machine using Ian Dixons 'MCEBackup' utility, which works really well.
  • Disk space was down to about 20GB free, on a 250GB drive
  • About every 30 minutes, usually when using the Recorded TV page the message appeared, and the machine stuttered for a few minutes, then came back to life.
  • A number of error logs appeared in C:\ProgramData\Microsoft\ehome (433 of them)
  • The machine started recording two scheduled shows, and then 'stuck' - the shows were (alledgedly) still recording the next day.

I dont understand what actually caused this, but I remedied with the following steps. If you want to actually keep all those series settings that you have booked in, then use Ian's MCEBackup utility to back them up before you continue.

  1. Stop "Windows Media Center Scheduler Service" and "Windows Media Center Receiver Service". Services
  2. Delete Recordings.xml , and Recordings.xml.bak from C:\ProgramData\Microsoft\ehome\Recordings
  3. Restart the "Windows Media Center Service Launcher" service
  4. Restore the recordings if you backed 'em up.

I skipped the restore, and booked the ones I wanted to keep in again using the keyboard, I suspect that 'series bloat' is more than a contributing factor here.

Now, I think we are looking at a number of bugs here Microsoft:

  • The recording disk space limit in the settings menu doesnt appear to work all the time - MCE went 'over' it's disk space budget, and when it's done this, it appears to refuse to delete shows that are old (which is the intended mechanism to make disk space)
  • 'Something' is going on with the Recordings.xml file - given that this is a fairly simple 'dump' of the booked in recordings I'm not sure what.
  • finally, the crash reporting on my machine doesnt appear to be reporting anything - I doubt that it has reported the 433 crashes to the mother ship - if this due to the nature of the issue, then I suspect it might not be hugely understood back in Redmond.

(one of the 433 crash reports)

[Crash Information]ReportVersion=2MainBinary=C:\Windows\ehome\ehRec.exeMainBinaryVersion=6.0.6000.16386 (vista_rtm.061101-2205)CrashTime=11/20/2007 22:54:41 UTCException=System.NullReferenceExceptionExceptionMessage=Object reference not set to an instance of an object.
[Stack Trace]IP=0x000001ad RecordingObjects.RecordingScheduleItem.get_AlternateAirings()+0x7A :0,0IP=0x00000166 RecordingObjects.ConflictManager.FixAlternateStates(RecordingObjects.RecordingScheduleItem item)+0x43 :0,0IP=0x00000055 RecordingObjects.ConflictManager.FixAlternateStatesOnStateChange(RecordingObjects.RecordingScheduleItem item, ehiProxy.DVRSTATE oldState, ehiProxy.DVRSTATE newState)+0x29 :0,0IP=0x000001b7 RecordingObjects.RecordingScheduleItem.StatePostTransition(ehiProxy.DVRSTATE oldState, ehiProxy.DVRSTATE currentState)+0x115 :0,0IP=0x00000166 RecordingObjects.RecordingScheduleItem.set_State(ehiProxy.DVRSTATE value)+0x9B :0,0IP=0x00000967 RecordingObjects.RecordingScheduleItems.ConsistencyCheck(System.Object state)+0x38E :0,0

Its a real shame that this particular issue is not well understood and patched already, as it may even be spreading like rot across the MCE Vista community (!).

So, my feature request for 2008, is that there be an update to Windows Home Server, that incorporates Media Center 'server side' functionality - so that the machine can be used as a media center via the new v2 Media Center Extenders - this way the MC becomes more 'appliance' like, there are less pathces and updates required (because there is less 'clag' on the machine), and it's therefore more stable... it will be interesting if this becomes a reality .. I suspect (as others do) that this will be a future version.. 8-(

Hey ho, roll on Feb 1st when we can get our hands on a Linksys DMA2100 extender.... 8-)