Poor Mans RFID
How to track presence/absence with an Oregon Temperature sensor.
While struggling with the need to tell if one or the other of our cars was at home via some RFID method I ran up against the difficulty of reception of the long range devices through the lath stucco and metal garage doors. There is simply no setup that will receive from a transmitter in my car both parked outside and inside the garage. There is another solution that doesn’t require the RFID devices at all, just an RFX Receiver and an Oregon Scientific temp sensor.
For some reason the range on the Oregon sensors to the amplified antenna I have attached to my RFX are excellent. If I put one in the car I can receive it in the driveway or inside the garage. Just a better tuned system. The cheapest Oregon transmitters can be gotten for around $20 all the time and half that periodically on sale. I had a couple of spares and put one in each of our cars, just down in the door pocket.
This works because the Oregon devices send an update every 30 seconds or so. XTension only executes the ON script for that unit if the temperature changes, but it updates a Unit Property called “Last Message Received” with each message, even if the temperature hasn’t changed.
So it’s possible to get a presence detection by watching this value every couple of minutes!
First you need a pseudo for the presence. I called mine “PMRFID Jamies Car”
Now I need a global script to run every few minutes to check the last message date of the temp sensor in my car. The nature of the oregon system and RF in general is that some packets will get lost or garbled even in the best system. So you dont want to turn off the presence indicator at one missed packet. I timed mine out at 4 minutes which is good enough for this. Turning them on however you would do at the very first packet received. So an off will take 4 minutes to generate, but the on will happen at most 30 seconds after you arrive back in range.
The global script would look something like this, and the code can be repeated for as many other units as you’d like to track. In this example the unit that is actually linked to the OreSci temp sensor is called “TEMP Mazda”
--first we need to date of the “last message received” property in the temperature sensor unit set TestDate to (Get Unit Property "last message date" from unit "TEMP mazda”) --if we subtract that date from the current date now we get the number of seconds since the last message was updated set Interval to (current date) - TestDate --if it’s more than 4 minutes (240 seconds) then we check our pseudo if Interval is greater than 240 then --but we dont want to keep turning off the pseudo over and over --so first check to see if the pseudo is on, and if so turn it off, otherwise do nothing, it’s already off if ((status of "PMRFID Jamies Car") is true) then turnoff "PMRFID Jamies Car" end if end if
Now create a scheduled event to run that global script every 2 minutes or so.
The code to turn it back on when I drive back up is in the ON script of the “TEMP Mazda” unit:
--if you create a handler for PropertyChanged you’ll get passed the name and value of any property that is updated on PropertyChanged(TheName, TheValue) --there are several properties that XTension sets automatically --and you can set as many more yourself, so verify that this is the message we’re looking for if TheName is "last message date" then --we dont even have to check the date, if we received this at all then the device is in range --again dont keep turning it on over and over, only turn it on if it’s currently off if (status of "PMRFID Jamies Car") is false then turnon "PMRFID Jamies Car" end if end if end PropertyChanged
Now the pseudo that this manages can be used to update thermostat setpoints, control extra outdoor lighting if you’re not home, be another input into the alarm system processing, or whatever. I’d shy away from using it to actually open a garage door as RF is subject to temporary issues and if you do that without some extra steps in the process you’ll wake some morning to find that it was out long enough to turn off the unit and your garage door has been sitting open all night. That would be bad. So far this has been quite reliable for me.