Saturday, October 25, 2008

Taming the Linksys DMA2100

We aquired a DMA2100 a couple of months ago to replace our CAT-5 S-Video boxes, for some increased picture quality- it's an impressive little unit, but there are some issues..

There have been a number of posts on the GreenButton here that indicate that MS/Linksys didnt really think through the real-world behaviour of people's extenders and their MCE machines.

If your MCE machine goes to sleep between recordings (this is a good idea, as most PC's are 200w of your electicity bill all the time they're on), or because of a timed sleep due to inactivity, the extender has trouble 'waking' it again when you want to watch TV. We leave our DMA2100 on all the time (because it takes about a minute to start up when the power comes on)

This hit me with a couple of issues

1) The extender can't wake the PC (WOL doesnt work, but a directed 'ping' wake-up is supposed to) - but didnt work for our MCE machine. I solved this by using a Perl script on my Linksys NSLU2 linux box which is in an earlier post below.

2) Once the MCE machine was being woken when the TV was being switched on, we still had the issue that the extender didnt 'notice' that the PC was now on- and sat at the useless 'Extender Disconnected' screen - not very transparent.

The above issue is solved by simply pressing the 'Start' button on the MCE remote, this is handy because if the extender is at the disconnected screen ,or at the main menu, it 'just connects' if the PC is on, and also if it's already connected it takes the extender back to the main MCE menu each time.

We use a Harmony 525 Intelligent remote, and this can even be taught to 'send' a 'Start' key when the TV is powered on - the result is that the MCE home screen greets us every time the TV is powered on to watch TV... Perfect 8-)

So Linksys? how about a firmware update with proper Wake-On-Lan support? - and hey, while we're at it , how 'bout 'polling' that MCE machine on the network to see if it's there, and restarting the extender session?

Oh yes, then there's that irritating BRIGHT BLUE LED on the front - but black masking tape soon solves that one 8-)

Monday, September 08, 2008

WakeUpTool (!) - Waking up your PC's with Domia Lite or BBSB Network Controller

If you've been reading closely, you'll have discovered an application on my blog for 'Sleeping' PC's on reciept of a configured Domia Lite / BBSB device code or event. Well, for some time, I've been pondering a solution to the other problem - that of 'waking up' PC's according to a Domia Lite command.


Now, you could take the brutal approach, and put a Domia Appliance Module on the power feed for your PC, but this would effectivley 'dump' the machine when the signal was recieved, though it would quite nicely wake (or boot) the machine when turned on, if you have a BIOS that supports power-on boot-up. (good luck with your data integrity on that one)

Here's a more elegant solution:

You can use Wake-on-Lan (WOL) to do this, but in order to do that, you need something that can send the WOL magic packet on reciept of a DLC code. Now, one day, Domia might add this to their controller (after all it's on all the time, and on the network) (hint hint hint domia), but until then, here's a perl script that you can run in the background on a Linux machine or device that will do the same job.

#!/usr/bin/perl -w

use strict;
use IO::Socket;
use Sys::Syslog qw( :DEFAULT setlogsock);

my($sock, $oldmsg, $newmsg, $hisaddr, $hishost, $MAXLEN, $PORTNO);
$MAXLEN = 1024;
$PORTNO = 53003;
my $programname = 'dlc.pl';
$ENV{PATH} = "";

$sock = IO::Socket::INET->new(LocalPort => $PORTNO, Proto => 'udp')
or die "socket: $@";

logit('info',"Listening on Port $PORTNO for Domia Lite Messages..");
print "Awaiting UDP messages on port $PORTNO\n";

while ($sock->recv($newmsg, $MAXLEN)) {
my($port, $ipaddr) = sockaddr_in($sock->peername);
#$hishost = gethostbyaddr($ipaddr, AF_INET);
print "Recieved DLC Command `$newmsg'\n";
logit('info',"Recieved DLC Command: $newmsg");

if ($newmsg eq "devicecommand:1a01:")
{
logit('info',"Waking PC..");
print "waking up PC.\n";
system("/sbin/wakelan -m 0123ABCDEF11");
}

}
die "recv: $!";

sub logit {
my ($priority, $msg) = @_;
return 0 unless ($priority =~ /infoerrdebug/);
setlogsock('unix');
# $programname is assumed to be a global. Also log the PID
# and to CONSole if there's a problem. Use facility 'user'.
openlog($programname, 'pid,cons', 'user');
syslog($priority, $msg);
closelog();
return 1;
}

Once you're up and tested (replace 0123ABCDEF11 with your PC's MAC Address, and correct the DLC code - example above uses A1 ON), you can add this to your boot-up so it runs in the background by appending the line

/wherever/dlc.pl & 2 >/dev/null

(dont forget the ampersand &, as your box will not complete it's boot up scripts.. like I did)

Now, clearly if you run a 150w PC all the time with this, then it kind-of defeats the point of all this, but some small embedded linux device, like a Router, or Unslung Linksys NSLU2 can do the job just nicely.


Stay tuned for some more postings in Perl, as we build a Home Automation controller out of that handly NSLU2 that takes a whole 2watts of power 8-)


Sunday, August 17, 2008

Another new build.. SleepTool 1.0.23

Oops, dumbo bug in the last build, meaning that if you wanted to send DLC commands from the application, you needed to specify your device codes with a trailing Zero.

Oops. Fixed in this build - thanks to StephenN for pointing out that it didnt work in the previous 1.0.22 build.

Saturday, August 09, 2008

New version of SleepTool for BBSB/Domia Lite

Crikey, it's been a little while since I posted - sorry about that - I'm still here honest.


This new version of SleepTool is a masterpiece of unfinished work, it does however now have code in it to support sending of BBSB/Domia codes to the BBSB Online Controller.

Reposting this due to broken links etc, code is included if you can still remember VB6 - enjoy.

Download ZIP of binary and VB 6 code.

I'd be interested in hearing from you if you've enhanced this or written any other Domia Lite code for other HA purposes.

Mart.

Friday, February 22, 2008

Update: BBSB Controller availability and Support..

I've had a few comments from readers about getting support for the BBSB Online Controller and related items.

I followed this up with Domia, and they confirm that they will respond within 24 hours on weekdays to e-mail support requests to 'Technical at SimplyAutomate .co .uk". - so if you have questions or issues with controllers , or the website service give that a try.

I'm also pleased to confirm that they tell me that the BBSB Controllers are only temporarily out of stock, and have not been pulled from their range ... hurray!

Monday, February 18, 2008

Domia Lite or Home Easy?

Further fuel to the rumour that actually B&Q's 'HomeEasy' range manufactured by Byron is actually spookily similar to Domia's Domia Lite range appeared today on Simply Automates new look online store:



On the left is the HomeEasy HE200 , On the right, is the new Domia Lite 'Timer' ...hmm.



New on the SimplyAutomate online store: http://www.simplyautomate.co.uk/acatalog/domialite.html is item above, it's twin the HomeEasy HE200 'Timer Remote', can be found here: http://www.homeeasy.eu/product2.php


Several people have posted on the net about them being similar, but I've not found any posts with lists of devices from the HE range that work with Domia Lite.... I'll keep looking, right up until I go to B&Q and pick up a few of the more interesting devices they have there...


On a more depressing note, I've been unable to find the famous BBSB Online Network controller mentioned in such a glowing light previously on the blog.

It appears that the controller (or rather all 4 flavours of it when it did exist) have been dropped from the SimplyAutomate store without trace, which I do hope isnt a sign that it's been axed from the Domia Range.... not good for us HA types, as we now have no way of talking to those lovely cheap Domia modules anymore 8-( ... or perhaps those nice B&Q Byron devices either.......

Saturday, February 02, 2008

Windows Home Server: What's inside..

I couldn't resist trying out Windows Home Server recently, so I sent off for the 180day eval DVD set and it arrived the other day.

Interestingly, a lot of the useful features are quite straightforward to implement on a normal Windows XP or Vista workstation, or on Linux if you're that way inclined.

A .homeserver.com Domain Name and SSL Cert.

Access to the server remotley is under SSL encryption in your browser, thanks to a server SSL Certificate.

Enabling internet functionality on the server results in your own SSL Cert being automatically provisioned by GoDaddy, and it would appear that its actually granted to the home-server DNS name you set up, and not just *.homeserver.com - interesting. More interesting is that my trial server dies in 179 days, but my free SSL cert will last until 2013 8-) -- ironically, this is of course tied to myservername.homeserver.com, and therefore it's impossible to pay a DNS provider for any .homserver.com DNS name anyway because MS own that - so no free lunch here 8-(



I'm also surprised that the product doesnt offer some sort of certificate based two factor authentication - say a private certificate based set of folders that would not open without password and installed certificate perhaps?

AV Protection

Nope! - a brave move for a product that is essentially based on Windows 2003 server with some changes, You will be asked to open ports 80, 443 and a few others to enable RDP to your clients on your home network. To leave this for any period of time without a supported AV product installed and working is not a smart move- especially with all your data loaded on there.

OneCare would have been a nice build-in for this, but clearly not. At the time of writing Avast! have a WHS aware AV product. -so there are options already.

X-Raid

I call it X-Raid, but there are other names for it, this is essentially a form of 'RAID' that creates redundancy by spreading your data, and (I'm assuming) parity for it around over the disks you have installed, despite them being different sizes - nice, though there have been many comments on the forums saying that the server 'balances' between disks all the time especially if you hit it with a heavy upload of files - I suspect a later patch from the mothership will set this up so it only happens at set time windows for example.

This is 'software' RAID whatever way you look at it, and it will never really compete with a hardware based controller with caching etc, that you find in commercial servers, and I wonder if a hardware option would be better given many OEM's have spun WHS dedicated hardware already...

I've yet to add more than a single disk to my WHS, so a more in-depth comment on this will arrive here later once, I've seen it at work.

Hacking already!

While at Tech-Ed I spoke to several MS staff regarding WHS and external network storage - many of us (including me) already invested in Home NAS devices (mine is a Synology CS107), which have redundant RAID on SATA disks already, and WHS's efforts are therefore less appealing to me - Sadly, MS told me a the time that there is no support for NAS'es, but as always, I set about working out how to share the folders on the NAS via the site regardless- my interest in WHS is remote access and backup primarily for now.

In actual fact , once you realise that a shared folder in WHS is resident on the D: drive of the server (your primary disk, 2nd partition if you have just the one ), and the neat folder interface is supplied by some ASP.NET in IIS on the machine, it becomes a little easier.

From what I can see, the actual interface shares the folder contents via some server-side code which cleary we probably cant force to show a non-local network share. (after all we're asking for 'share forwarding' something that windows cant do anyway).. except in IIS...

It is possible to create virtual directories in IIS to point to network locations, and this appears to work nicely as it does on any other windows IIS box.

Sniffing around in the iis folders gave away how to add some links to the WHS web page:

  • Set up a virtual directory in IIS pointing to your remote system, I selected 'always validate the authenticated users credentials' which uses the user you logged in as (make sure they have a matching username and pw on the remote server, or NAS)
  • Ensure you enable 'Read' and 'Directory Browsing' ,then click 'Directory Security' then click 'edit' and remove anonymous access! - select 'basic clear text auth' - if you enter via SSL I think you're encrypted anyway?
  • Copy WHS the c:\Inetpub folder somewhere as a backup, first before interfering..
  • Edit c:\inetpub\wwwroot\remote\default.aspx and locate the line with

if (Has3rdPartyWebsites)

<%if (Has3rdPartyWebsites){ %>

(remove it, along with the corresponding <%} %>bit as well at the next paragraph)

  • Edit c:\inetpub\wwwroot\remote\websites.aspx and add a few lines like this (one for each link)
  • Where 'name' is the link name, uri is the path to the virtual dir you created (I put mine under remote), and imageUrl points to something pretty - like the graphics in the images folder)

When you click the links you do get the ugly IIS folder list, but there are 3rd party apps to make this look nice, and I'm not giving up just yet on adding it to the folder tab in the main site 8-)

If you're listening MS: Remote storage (E.g NAS'es) would be a nice supported feature, especially if you then consider making the WHS an embedded device with LOW power consumption and no moving parts 8-)

More on WHS later as I'm not done, with 178 days remaining, though I must say all it's done is made me think that my 'unslung' Linksys NSLU2 (Which uses a 1/10th of the electricity of my WHS) is capable of most of the functions I need, I may need to explore this further - if I do I'll post what I've built - think 'embedded WHS' with Linux 8-)

We have to be mindful that WHS is targeted at the average consumer, and for that it's a great solution, especially looking at the fine examples from the OEM market (HP, Tranquil etc), I suspect the geek movement are busy as we speak moving features onto this platform ..

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 255.255.255.255 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.
Update
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 VBForums.com (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?


Mart../

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-)