Misterhouse floorplan code snippet

The current floorplan.pl code in MisterHouse annoyed me, as you will likely have an actual floorplan as an image already (if you buy or rent), and thus overlaying your HA kit on top of it saves time and it looks much neater (shows the pool, or whatever other things you have, staircase, etc etc).
So please see below, grab this code and set your images / floorplan, and you'll get a pretty neat result :)

Steps to use it:

1: Save this as /mh/web/ap/floorplan.pl (or whatever location your MisterHouse install is in)
2: Put your floorplan image in your MH dir - the code below uses '/mh/web/ap/floorplan.jpg' (this is a real floorplan, like you get from the realestate agent/online-advert)
3: Fill out the ap_objects variables by editing the code, setting your X / Y and image name you want to display for the item (is it a light? camera? heater? hawkeye?).
4: Use it! (you can replace /mh/bin/floorplan.pl if you like..)
5: Don't forget you will need an ON and OFF image, so it shows the light/device/appliance on and off.
These can be the example/included images from MisterHouse (find them in your MH path: mh/web/graphics/), as seen below in the example (a single light, in the On state, a red/green dot) or something custom. Remember that '-on' and '-off' are appendded to the image to determine the state, so you'll need "hawkeye-image-on.jpg" and "hawkeye-image-off.jpg".

The result is something like this [it only has 2 items on the screenshot sorry, not showing exactly where all my cameras/motion sensors are ;)]

When you click on the object, the state changes from the current state (eg: if its on, an 'on' image is shown, and it turns off. exactly the same as the default floorplan code)


Download code is here









20090920 - first dump of notes
20101228 - update image-on info