Ping Sensor

I’ve got the Ping sensor up and running in UI4, graphics and all.
My question is, once its tripped, how do i reset it to untrip and re-arm?

Ive been following some scenecoding threads and was thinking this thread could help?
http://forum.mios.com/index.php?topic=6685.0

Using some part of the code mentioned there, courtesy of @Samea with added suggestion of @Ap15e
Any suggestions?

@Samea’s code

[code]
–identification
local magnetDevice = 7
local movementDevice = 10
local SS_SID = “urn:micasaverde-com:serviceId:SecuritySensor1”

–untrip the device
luup.variable_set(SS_SID,“Tripped”,“0”,magnetDevice)
luup.variable_set(SS_SID,“Tripped”,“0”,movementDevice)

–suggestion to pause before sending next command for n seconds

–re-arm the devices
luup.variable_set(SS_SID,“Armed”,“1”,magnetDevice)
luup.variable_set(SS_SID,“Armed”,“1”,movementDevice)[/code]

But how to bring @Ap15e suggestion into the equasion?

luup.call_action / SetArmed / newArmedValue

Hope anyone can help me advance this…

What are you trying to achieve, if you could get it to do that?

I have a wireless device thats pretty much stretched out to its limit on wifi signal.
If i loose connection, i want to be notified, then rearm the trigger (say every 5 or 10 minutes) and loop the process that way.

This gives be a sence on how often the devices loses connection and i can either manually interfere or see when the device is back online.

For presence functionality this could provide not only event triggering, but also notifications on arrival (but i agree the RFID solution is more solid there)

Problem at hand right now is that the sensor doesnt re-arm…

I’m not sure if it changed, but there used to be a time when notifications would keep coming once something was tripped. If this still worked then you could set the notification for un-tripped and it would notify you every 15 mins if it did un-trip.

@guessed had a post about this, as the logic changed at some point, I’ll see if I can dig it out.

Would that have achieved what you were looking for?

It Might be worth the effort and trouble to try and increase the range with antennas etc, rather than chase this :slight_smile:

Regarding the above, you wont be able to see this thread as its in the beta area, but I’ll copy @guessed’s posts here:

At some point in the last releases, not sure when, the behaviour of S_SecuritySensor1.xml was changed to "allowRepeats=yes" for change notifications on "Tripped" state.

@woodsby noticed this one, and we’ve been PM’ing about it:

Here’s the snippet from the newer S_SecuritySensor1.xml file
Code:

[code]
Tripped

   <sendEventsAttribute>yes</sendEventsAttribute>
   <dataType>boolean</dataType>
   <shortCode>tripped</shortCode>
</stateVariable>[/code]

and it now has the "allowRepeats=“yes”, which is contrary to the original setup, per this discussion:

http://forum.micasaverde.com/index.php?topic=1591.0

Can you restore the prior file to avoid the functional regression?

UPDATE 19th Jan: Filed Ticket http://bugs.micasaverde.com/view.php?id=1384 to formally track the Regression.

I guess the relevant part is here:

http://forum.micasaverde.com/index.php?topic=1591.0

@strangely,

Gee thanks! (sigh, even more data to process ;-))

I done the network tinkering thing (not easy with fixed antennas), installed a repeater, etc etc
I’d like to see if I can relate the loss of signal to time of day or any other environment variable.

Might end up with a homeplug setup to carry the signal via mains.

Having said that, I’m also trying to learn and see Vera as a hobby (ask my wife ;-))
therefore I’m exploring what can and can’t be done, what’s functional and what not…

I’ll take the info you gave me and will check my XML files.
Thing is, I got my sensor package by d/l it from the forum and tweaking it as per forum directions to get it to work with UI4.

So I might just have a version that lacks the codesnippets you suggest.
Will report later on my findings and would like to thank you for your efforts do far!

@Henk,
I read the above posts but still not 100% sure what your asking about re-arming.

I have a wireless device thats pretty much stretched out to its limit on wifi signal. If i loose connection, i want to be notified, then rearm the trigger (say every 5 or 10 minutes) and loop the process that way
So you basically want to monitor your wifi? Why not install the D_PingSensor_Invert.xml to trip on losing the signal?

Unless I’m missing the point of what your trying to do?

JOD.

[quote=“JOD, post:67, topic:164895”]@Henk,
I read the above posts but still not 100% sure what your asking about re-arming.

I have a wireless device thats pretty much stretched out to its limit on wifi signal. If i loose connection, i want to be notified, then rearm the trigger (say every 5 or 10 minutes) and loop the process that way
So you basically want to monitor your wifi? Why not install the D_PingSensor_Invert.xml to trip on losing the signal?

Unless I’m missing the point of what your trying to do?

JOD.[/quote]

I’m slowly getting the idea that either im taking the wrong approach OR my sensor does stuff you guys dont experience.

Ill try to explain.

I HAVE used the inverted logic, having the sensor trigger when the IP was unavailable.
I ALSO tried the trigger in the regular way (checking when my wifes iPhone came home)

In both occcasions i get a trigger, no problem.
BUT, the trigger (little red guy running) never resets… thus trigger state stays enabled even if IP isnt detected anymore (in normal mode) ar is detected again (in inverted mode).

Is this just me doing something wrong?

OK so its doing something wrong, mine will reset if the device goes offline.

Ill check the xml data you provided and report back, maybe thats something to do with it…

Mine resets too (iPhone) when the phone goes to sleep or if I turn WiFi off.
I’m sure @oTi@ will pop up here any minute with the link to the correct download.

JOD.

*Edit. @Henk, wasnt there a patch for this? Did you install it?

Ill check the xml data you provided and report back, maybe thats something to do with it…[/quote]

The data I posted before was more to do with repeat notifications.

[quote=“JOD, post:71, topic:164895”]Mine resets too (iPhone) when the phone goes to sleep or if I turn WiFi off.
I’m sure @oTi@ will pop up here any minute with the link to the correct download.

JOD.

*Edit. @Henk, wasnt there a patch for this? Did you install it?[/quote]

Im unaware of that… the patch i found was getting the sensor to work with UI4 and had to do with consistent linking to the json file in the xmls…

Maybe @oTi@ could add that link too :wink:

I do remember this problem with this device, I was having a convo with @iFlyM3 about it. When I added ALL your files it started working…

http://forum.micasaverde.com/index.php?action=dlattach;topic=6096.0;attach=2251

JOD.

[quote=“JOD, post:74, topic:164895”]I do remember this problem with this device, I was having a convo with @iFlyM3 about it. When I added ALL your files it started working…

http://forum.micasaverde.com/index.php?action=dlattach;topic=6096.0;attach=2251

JOD.[/quote]

Isnt there a complete package on the code page?
If not, we might have to consider to post the full set in this thread once more to eliminate problems for other users…

[quote=“strangely, post:65, topic:164895”]Regarding the above, you wont be able to see this thread as its in the beta area, but I’ll copy @guessed’s posts here:
At some point in the last releases, not sure when, the behaviour of S_SecuritySensor1.xml was changed to “allowRepeats=yes” for change notifications on “Tripped” state.

@woodsby noticed this one, and we’ve been PM’ing about it:[/quote]

Here's the snippet from the newer S_SecuritySensor1.xml file Code: [code] Tripped
   <sendEventsAttribute>yes</sendEventsAttribute>
   <dataType>boolean</dataType>
   <shortCode>tripped</shortCode>
</stateVariable>[/code]</blockquote>

My xml doesnt have that piece of code…
Ill upload my packegae here to serve as comparison for those participating in this discussion.
As im only allowed to upload 4 files ill zip it (knowing the TFP policy of @JOD) anyway.

i HAVE adapted the code for UI4 creating the json statements pointing to the json file as per directions in this very thread.

Hope one of you can find something i missed…

Then one more, if i wanted to ADD the , where would i put it in the code? simply at the end?

–EDIT–
I removed the sensor and created a new one with the existing D_PingSensor.xml
Armed the sensor and it works. Ip detected, on (set a scene to switch on a light) After removing the device from the LAN the trigger rest to “armed” as it should!

Thats on part of the mystery solved, i probably had a corrupt device.
Then there is the issue of the bypass button not working (“delivery failed”) has anyone looked into that and solved it for UI4? NOTE, manually changing the Armed variable for 1 to 0 and saving the device DOES set it to bypass, so its just the button not working.

One more (im on a roll :D), when the trigger returned to “armed” and the little red man colled of and went back to blue, my light didnt switch off. I couldnt find anything in the event to set that option. Does it have to be coded in with luup? (like: lamp on when IP is detected because pingsensor tripped, lights off when IP is not detected by pingsensor anymore)

You can create a second scene and have it do the reverse I guess?! The tripped event can be either tripped “yes” or “no”

@strangely

Ok, thanks for that logical pointer!
Now I’m slowly starting to understand why people ask
for IF & AND logic…

So much for ping sensors normal functions.

Anyone on why the bypass button doesn’t work?
Look like a small coding glitch since manual override works

and what about the repeat notifications part?
Where should I add that in the XML?

The bypass button works for me via the UI and within scenes.

The bypass function not working was an old issue (old code) that was fixed with your code. The Ping Sensor works perfectly.

@Henk you seem to have regressed!!

JOD.

@JOD

as I recall you grabbed pieces from anywhere.
My addition made the json reference in XML complete. Therefore your plugin started to work.

Presumably i have some other outdated xmls since i cant locate the codesnippet @strangely mentioned either.

I would appreciate it if someone would attach his XML files here (@JOD perhaps)
i can then remove my upload an ppl can acces the latest working plugin.

Thats what happens of noone keeps track of versions and builds :frowning: