RFXrtx433 As A Proximity Sensor (Potential?)

I though I’d create a separate discussion stream and make make use of the child board. (One for lolodomo)

A number of battery operated sensors (e.g thermometers) constantly keep transmitting, so I was wondering if the current plugin could be adapted (or a simple second version be created) that could work as a proximity sensor?

For example, if i was to identify a 433mhz device as ‘me’, it could be set to constantly look for me, and then when I’m found, I could set Vera up to then trigger suitable scenes according? (So basically the rfxrtx433 would also be able to act as a sort of Motion/Proximity Sensor)

Assuming all this is possible, it could then evolve (or a stand alone plugin be duplicated) to identify each member of the family, and maybe even be used to tell you if the kids (or a pet) have stray too far from the house?

Now, I’m not sure what the best RFXCOM supported 433mhz device to use for this, but tests with a simple Oregon Scientific temperature sensor shows it would work really well to identify people who are in the house, or if the car has pulled into the drive.

Thought/Comments welcome

I see what you mean, that would be possible using sensors transmitting often like weather sensors.

I think you have already everything you need. What you have to check is the variable “BatteryDate” and more precisely the difference between the current date and time and BatteryDate. A soon as it exceeds a certain delay, it would mean the RFXtrx has not received data from this sensor during the elapsed time, and you could conclude that the sensor has moved away.

Hi lolodomo

Thanks, if you ever feel like developing a spin off of your plugin in the future - you have one customer right here (maybe more??) :wink:

A benefit of having this as a separate plugin would be that it could be set up as a motion sensor device, so green when the item is in range an red when out (i.e tripped) it would also make it much easier for working in to scenes.

And (correct me if I’m wrong) but could it potentially use undecoded 433mhz protocols too, as all that’s required is some sort of 433mhz signal/device identifier that can be captured by the transciever - and cross referenced to a value you specify via the settings?

I’m looking to see what the smallest battery operated 433mhz device is out there that regulary transmits information.

UPDATE - Some of the 433.92mhz devices I’m looking at include the anti-lost marketed ones, such as

http://www.surmall.com/best-selling-children-anti-lost-alarm.html
http://www.inesun.com/Anti-Loss-Safety-Set-including-Keychain-Receiver-and-433.92MHz--17238.html
http://www.surmall.com/personal-anti-lost-theft-burglar-alarm-device.html

If it can work with coded or decoded information, then the device scope could be very broad?

Sorry, just thinking out loud, to see how else I could utilise more my investment in the transceiver and your brilliant plugin …

Hi

Can anyone help me with the code for a proximity sensor, I’d like it to switch on a Virtual Switch if a device is not found for a period of time, however the following seems to go ok, but does not seem to work :frowning:


-- Picking the devices
local SENSOR = 42 -- The anti-lost sensor device number
local VSWITCH = 15 -- The virtual switch device number


-- Add any parameters
local DELAY = 6    -- Seconds
 
-- Picking the services
local SES_SID = "urn:micasaverde-com:serviceId:HaDevice1"
local VSWI_SID = "urn:upnp-org:serviceId:VSwitch1"
 
luup.call_delay( "turnOnVswitch", DELAY)
 
-- Turn on the virtual switch if the anti-lost sensor hasn't been updated in the past x seconds
function turnOnVswitch()
    local update = luup.variable_get( SES_SID, "BatteryDate", SENSOR)
    if (os.time() - update>= DELAY) then
        luup.call_action( VSWI_SID, "Status", {newTargetValue= "1"}, VSWITCH)
    end
end

I’m trying various versions of the above but no joy so far…

[size=2]UPDATE: I realised I had the wrong service listed, i had urn:upnp-org:serviceId:TemperatureSensor1 rather than urn:micasaverde-com:serviceId:HaDevice1, but it still does not work .[/size]

Another version, but still no joy… Help?

[code]-- Picking the devices
local SENSORID= 42 – The anti-lost sensor device ID number
local VSWITCHID = 15 – The virtual switch device ID number

– Picking the services
local SENSERV = “urn:micasaverde-com:serviceId:HaDevice1”
local VSWISERV = “urn:upnp-org:serviceId:VSwitch1”

– Run
luup.call_action( “turnOnVswitch”)

– Function is to turn on the virtual switch if the anti-lost sensor hasn’t been updated in the past x seconds

function turnOnVswitch()
local update = luup.variable_get(SENSERV, “BatteryDate”, SENSORID)
if (os.time() - update >= 6) then
luup.call_action( VSWISERV, “Status”, {newTargetValue= “1”}, VSWITCHID)
end
end[/code]

Anyone?

Anyone ? I would love to work out how to do this?

Je pense que c’est cette ligne qui est fausse:

luup.call_action( VSWISERV, "Status", {newTargetValue= "1"}, VSWITCHID)

L’action ne s’appelle pas “Status”. Vérifie dans le wiki, je n’ai plus le nom en tête.
Et rajoute un luup.log(“toto”) dans le if pour être certain que tu passes bien dedans.

Thanks for responding lolodomo - and thank god for google translate (I recall some French from school but not enough to talk technical :wink:

OK, now ‘Status’ is the binary value on the Virtual Switch plugin variable for on or off, but thinking about it, I will change the code so it runs a scene when it does not see the ‘sensor’.

Let me see if I can get that to work. (This is my first real attempt a coding anything :wink:

;D ;D ;D
Sorry, it was my intention to use French. I am often at the same time on two forums, this one and another french forum, that could explain my mistake.

I was just telling you that Status is not the name of the callback.

You have an example here:
http://wiki.micasaverde.com/index.php/Luup_Lua_extensions
The callback name is SetLoadLevelTarget

Haha, go ahead, the translation practice is doing me good. And now I know to tutoyer on the forum!

;D - it allowed me to test my basic French too .

Thanks again, OK so it sounds like you’re suggesting it is…

luup.call_action( VSWISERV, SetLoadLevelTarget, {newTargetValue= "1"}, VSWITCHID)

I’ll give it a try when I get back…

So why does the Virtual Switch Variable list shows the on or off (1 or 0) value in a field called ‘Status’ - is that irrelevant then?

[quote=“parkerc, post:11, topic:172854”]so it sounds like you’re suggesting it is…

luup.call_action( VSWISERV, SetLoadLevelTarget, {newTargetValue= "1"}, VSWITCHID)

Don’t forget to put quotes around “SetLoadLevelTarget”.

So why does the Virtual Switch Variable list shows the on or off (1 or 0) value in a field called 'Status' - is that irrelevant then?

The variables that a device has and the actions that you perform on the device exist in two separate namespaces. So you’ll find yourself using one set of names with luup.variable_set() and a different set of names for luup.call_action().

Hi lolodomo

The other piece of code I tried (to avoid the Virtual Switch) was to run a scene when the sensor was out of range - pulling bits form other posts i came up with the following, but this did not work either.

[code]-- Picking the devices
local SENSORID= 42 – The anti-lost sensor device ID number

– Picking the services
local SENSERV = “urn:micasaverde-com:serviceId:HaDevice1”

– Run
luup.call_action( “AlarmBell”)

– Function is to trigger an alarm via a scene on if the anti-lost sensor has not been updated in the past x seconds

function AlarmBell()
local update = luup.variable_get(SENSERV, “BatteryDate”, SENSORID)
if (os.time() - update >= 3) then
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”,“RunScene”,{SceneNum=“18”},0)
end
end[/code]

The log suggests something like " GetLuaInterface can’t find device type"

Forgive the question, but what am I missing?

Also, this is just a one off check, how do I make it check regularly?

Thanks futzle

OK sure, but out of interest why, I thought quotes were to show a label look up or to input a text value or something?

:smiley: Nothing like making it easy for the newbies :wink:

Sorry to keep asking for help, but I just love the scope of using the rfxrtx plugin as a proximity (Anti-Lost) sensor, but being such a novice, coding does not come naturally.

The code I’ve got so far is the last one posted above, but to help I’ve pasted it in again below, my expectation is that if the batteryDate is more that 3 seconds old that the OS clock time, then it would run a scene?

[code]-- Picking the devices
local SENSORID= 42 – The anti-lost sensor device ID number

– Picking the services
local SENSERV = “urn:micasaverde-com:serviceId:HaDevice1”

– Run
luup.call_action( “AlarmBell”)

– Function is to trigger an alarm via a scene on if the anti-lost sensor has not been updated in the past x seconds

function AlarmBell()
local update = luup.variable_get(SENSERV, “BatteryDate”, SENSORID)
if (os.time() - update >= 3) then
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”,“RunScene”,{SceneNum=“18”},0)
end
end[/code]

It tells me message sent successfully but nothing occurs.

I’d love to be able to create a standard Motion Sensor device that simply looks for a defined

Hi All

Ok, I have shared my first attempt at a Proximity Plugin here - http://forum.micasaverde.com/index.php/topic,12093.0.html

It is currently untested, and it is looking for feedback from people on the code first before testing starts etc.