In the move to put as much of my house onto twitter as possible, MythTV was the next victim. I’d previously made a PHP script that sent MSN alerts, but now I don’t use MSN, it needed a revamp.

I knocked up a small PHP script that grabs the backend status, finds what is being recorded or watched, compares with the previous run, and sends a message to twitter using wget.
To use it, grab the script, change the username/password variables, chmod +x it, and then add it to your “Startup Applications” or equivalent if you’re not using Ubuntu.
Something that drives me nuts is every so often there’ll be an accident on the M3 or M27 and the entire surrounding area will be flooded with people trying to avoid the deadlock, only to find they’re on a tiny road with thousands of other people. Yes, I could check the traffic websites each morning, or do some intelligent parsing of traffic RSS feeds, but the first option requires effort before 9am (not going to happen), and the second option is never going to be reliable enough – it’d be too hard to programmatically determine how bad the conditions on the road really are.

Read more…
One bitsbox order and a trip to buy some deodorant later, and my arduino is boxed up, and ambient light has a stand!

The cap off an addidas deoderant can makes a nice enough base for the orb from a B&Q disco lamp (no link as can’t find it online). I soldered the ends of some CAT5 to the BlinkM, and left the other ends loose to be shoved into the arduino.

As I’ve got an arduino and ethernet shield, I went for the second largest ABS box and even then, I had to break off the screw connectors on one side so that the plugs could stick through the outside. I soldered the AM receiver and transmitter onto a small piece of stripboard (also from bitsbox), added a couple of wires for aerials (with a knot in each to prevent someone pulling it out the circuit). So that’s pretty much the finished product, what a shame! I will add a thermometer to it so it can become a thermostat in another room – eventually this’ll go in the sitting room, so will have the current cost meter producing one temperature reading from the kitchen, this one in the sitting room, and have just ordered another arduino for my bedroom’s ambient light/thermometer/development board.
The java code has been working nicely, turning the heating on and off via the hacked home-easy plug! I sent a text from my phone to turn the heating on, very proud of actually finding a use for it as I was stuck in traffic but had friends coming round so the heating would have cut out at 5.30 (it heats up til 5.30, then waits for movement) – only to find there was a street power cut that has lasted 3 days (intermittently)! So, if the power holds up a little longer, I should get a tweet tomorrow telling me how long the central heating was on for, fingers crossed!
So, time to write the web interface, pretty dull
As this is my first post about Magic Hat, a little introduction. Magic Hat is a site for magicians to learn magic, with over 50 thousand users. I started it in 2004, and since then have gradually (or not so gradually) being changing it. We’re now at the 8th major redesign. It started as a good way to learn PHP/MySQL/HTML, so I didn’t touch any content management systems, and wrote the entire first 3 versions with linux’s best text editor, vim! I then treated myself to using Eclipse, which saves a lot of work – Ctrl + Space and your website’s done (I wish!). Then I chucked in a phpBB forum, modified it and my site so that they’re nicely integrated. Finally, I changed to using smarty templates, which has made changing the look of the site in the last few versions significantly easier – would highly recommend it.
So, you’ve probably gathered that I’ll happily reinvent the wheel many times over, but hopefully for a good result. Magic Hat is very dynamic and has lots of complicated features that I don’t think would have been feasible to get working in something like WordPress without having to learn and change most of WP.
I’ve setup the Magic Hat forums to tweet every time someone posts, but I didn’t really want to use tinyurl/bit.ly as I’d like to keep magichat.co.uk in the links. So, here’s some code that creates the smallest possible hash.
Read more…