All posts by Martyn Wendon

IT Specialist | Project / Product Manager | Technology Geek | Why? Because I Can!

Daddy, the garden gate is open again – Visonic, RFXCom, xPLRFX and xAP Floorplan, a technological solution to a behavioural problem :-)

So we’ve got a gate down the side of the house that leads to / from the back garden to the front garden & drive.  When our kids are playing outside we typically leave the gate open to let them “roam free” between front and back gardens.

Unfortunately this usually leads to a last minute panic just before I go to bed of “did I close the gate”, or, worse still, the following day the kids taking great pleasure in telling me “you forgot to shut the gate last night”!

Many moons ago I used to manage various Microsoft servers and a source of great information was Ed Crowley, an MVP (Microsoft Valued Professional).  Ed’s catchphrase was “There are seldom good technological solutions to behavioral problems“.  This statement I have found to be pretty much spot on over the years 🙂  But maybe not this time……

As I’ve mentioned many times before, one of the benefits of a modular Home Automation system is that it’s very easy to add a new device and logic to handle situations like this.

So as we head towards Spring (in theory) and our kids start playing outdoors more regularly again I figured I’d implement a technological solution to my own behavioural problem 🙂

In this case, I already use the excellent xAP Floorplan for most of my HA logic and have RFXCom transceivers with xPLRFX integrating Visonic Magnetic Contact Switches and I had several MCSs in the spares cupboard, so it made sense to “use what I already had“!  I could have gone the Z-Wave route, as I’ve been trying to move to more Z-Wave devices lately, but I decided that the cost of another Fibaro Universal Door & Window Sensor wasn’t worth it in this case.

It was a simple enough addition to my HA system, it just needed an MCS fitting to the gate and then logic in xAP Floorplan to send a reminder at say 19:00 if the gate is still open.  I already have an extensive notification system available – SMS, eMail, Prowl, Growl, Logitech SqueezeBox display, etc – so it’s pretty trivial to add an alert for something like that.

The only issue that I had was that the Visonic MCS aren’t rated for outdoor use – they’re not weatherproof.  I might be wrong, but I don’t believe that they make one that’s rated for outdoor use either – although I guess that there’s probably not much call for one!

I’m a great believer in using stuff that I already have lying around, so I re-purposed an IP66 rated enclosure that I found knocking around in the garage.  I use these for mounting POE supplies for some of my external CCTV cameras and have always found them to work well, keeping the electronics inside as dry as a bone.

IP66 Enclosure
IP66 Enclosure

It was a simple enough job to install a Visonic MCS inside.  I decided to mount it in the lid section, mainly because it was easiest and required only a small amount of fettling of the plastic case on the MCS itself:

Visonic Magnetic Contact Sensor In IP66 Enclosure
Visonic Magnetic Contact Sensor In IP66 Enclosure

A cut-down rawl-plug stuck to the base of the enclosure with some epoxy resin makes sure that the tamper spring is held in place once the lid is fitted:

IP66 Enclosure Lid
IP66 Enclosure Lid

This all seemed to work ok, with the MCS installed in the lid it was still close enough to the edge of the enclosure for the magnet to operate the reed switch successfully.  Next up was installing the enclosure on the gate itself:

IP66 Enclosure Install On Gate 1
IP66 Enclosure Install On Gate 1

Pretty simple stuff really!  Screwing on the lid and this part is done:

IP66 Enclosure Install On Gate 2
IP66 Enclosure Install On Gate 2

Now to mount the magnet – since the IP66 enclosure is quite deep, I had to raise the magnet off of the gate post on the left somewhat.  A more appropriately sized enclosure would have helped make things look a bit neater, but functionality is more important than looks at this stage 🙂

Visonic Magnetic Contact Sensor Magnet Mounting
Visonic Magnetic Contact Sensor Magnet Mounting

Everything lines up perfectly when the gate is shut:

Visonic Magnetic Contact Sensor Finished
Visonic Magnetic Contact Sensor Finished

So, that was the hardware side taken care of, now for the software!  As I mentioned previously, this is fairly trivial.  The Visonic sensors are all exposed as xPL devices by the combination of the RFXCom Transceiver and xPLRFX.  xAP Floorplan bridges the xPL protocol to the xAP protocol.

Since I already have logic in place with xAP Floorplan to handle sensor events, it was simply a case of adding a few more lines of scripting:

If strMCS = "sidegatemcs" and stateMCS = "on" and Hour(Time) >= 19 Then

	'send osd message for squeezeboxes
	sendxAPSlimServerOSD "House Alarm: [Alert] - " & formatDate(DAY(date()),2) & "/" & formatDate(MONTH(date()),2) & "/" & YEAR(date()) & " - " & Time, "Side gate is open",  "30", "1", "Immediate", "ersp.slimserver.ahscctvserver:*"

	'send email message
	sendEmail "XXXX@XXXX", "XXXX@XXXX", "House Alarm: [Alert] - " & formatDate(DAY(date()),2) & "/" & formatDate(MONTH(date()),2) & "/" & YEAR(date()) & " - " & Time, "Side gate is open", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "xAP Floorplan", NULL	

	'send tts message
	sendxPLTTS "House Alarm Alert. Side gate is open.", "100", "VW Kate", "0", "bnz-tts.ahspogoplug3"

	'send prowl
	sendxAPNotifyProwl "1", "House Alarm: [Alert]", formatDate(DAY(date()),2) & "/" & formatDate(MONTH(date()),2) & "/" & YEAR(date()) & " - " & Time & " Side gate is open", "ahs.notify.ahssvnserver"

	'send nma
	sendxAPNotifyNMA "1", "House Alarm: [Alert]", formatDate(DAY(date()),2) & "/" & formatDate(MONTH(date()),2) & "/" & YEAR(date()) & " - " & Time & " Side gate is open", "ahs.notify.ahssvnserver"

	'send growl
	sendxAPNotifyGrowl "1", "XXXX", "XXXX", "House Alarm: [Alert]", formatDate(DAY(date()),2) & "/" & formatDate(MONTH(date()),2) & "/" & YEAR(date()) & " - " & Time & " Side gate is open", "1", "ahs.notify.ahssvnserver"
	sendxAPNotifyGrowl "1", "XXXX", "XXXX", "House Alarm: [Alert]", formatDate(DAY(date()),2) & "/" & formatDate(MONTH(date()),2) & "/" & YEAR(date()) & " - " & Time & " Side gate is open", "1", "ahs.notify.ahssvnserver"

	'send xmpp
	sendxAPNotifyXMPP "1", "XXXX", "XXXX", "XXXX@XXXX", "House Alarm: [Alert]", formatDate(DAY(date()),2) & "/" & formatDate(MONTH(date()),2) & "/" & YEAR(date()) & " - " & Time & " Side gate is open", "xmpp.org.uk", "5222", "ahs.notify.ahssvnserver"

	'send kannel
	sendxAPNotifyKannel "1", "ahspogoplug1.aceshigh.local", "13003", "test", "test", "XXXX", formatDate(DAY(date()),2) & "/" & formatDate(MONTH(date()),2) & "/" & YEAR(date()) & " - " & Time & " Side gate is open", "ahs.notify.ahssvnserver"
	sendxAPNotifyKannel "1", "ahspogoplug1.aceshigh.local", "13003", "test", "test", "XXXX", formatDate(DAY(date()),2) & "/" & formatDate(MONTH(date()),2) & "/" & YEAR(date()) & " - " & Time & " Side gate is open", "ahs.notify.ahssvnserver"

End If

In xAP Floorplan I have “Global” functions already defined that do the heavy lifting for sending out different xAP Schema messages.  This makes it really easy in logic like the above to simply call those functions with appropriate parameters and have the relevant xAP message fired off.

Overall this little solution is working great now, a few tests of leaving the gate open result in the appropriate notifications being sent out, prompting me to nip round and close and lock it.  Hmmm….it would be really cool to be able to automatically close it though……maybe that’s a job for another day!

While I’m thinking about it, I might as well apply the same logic to the Garage door – not that I’ve ever forgotten to close that of course, nor had a neighbour knocking on the door upon returning from the pub at midnight to remind me it’s still open 😉

Thanks for reading,

Martyn Wendon