Dog Door Tracking - Restricting Triggers


#21

You bet!


#22

The piston still isn’t working, and after further research, I realize it’s because the 3-axis numbers are not consistent. Long story short, I think I may be able to make it work using something similar to what you suggested, @WCmore, but I’m having a hard time figuring out how to store a list of values to a variable.

What I want to do is this:

  1. On events from the Multi-Purpose sensor, store all x-axis and z-axis values in a list. Any time the door opens, it should register around 10 values.
  2. Find the average, max, and min values of the x-axis and the z-axis of that “batch” of numbers for further use

Can’t find anything in the forums…


#23

SmartThings is not so great at capturing 10 events from a single device within 3 seconds…
(I was thinking the first 4 swings at most - or outside the range of -150 and +150)

Perhaps more importantly, there is no guarantee that the device will only report the highest part of each swing…


#24

Yes. Your high or low threshold should be much closer to zero than your highest swing


#25

Could you shed some light on how I get Webcore to store a list of sensor data into a variable?

For example:

IF
[door moves out of “static” range]

THEN
[Capture all events that Webcore receives for the X-axis for the next 10 seconds?]

Thoughts?


#26

Really just looking for how you’d do this…


#27

Sorry… Walking out the door right now… Be back in about 20 hours


#28

No prob. Thank you.


#30

I whipped up a quick piston to show these mathematical formulas at work:

(Note, this example has no negative numbers, so it made more sense to make the last line subtract, instead of add)


I am a bit backed up with clients at the moment, so I will let someone else chime in for the capturing question you had.


#31

Thanks. @WCmore. Anyone else able to weigh in on how I get the piston to store all x-axis readings during a brief period?

For example, it might read

IF door axis moves out of a range
THEN collect every x-axis reading that comes through for the next 5 seconds.

I understand, now, how to store a list of items to a variable, but I don’t know how to tell it to pull each unique values as they come in over time and append them to said list…


#32

Triggers here in webCoRE will execute the same piston each and every time the event fires…

Also, for what it’s worth, I would not use variable lists. For example, if a variable array has 8 data points, that variable does not want to change later to become 7 or 9 data points. I would stick with multiple individual variables, as seen in my example earlier.


#33

If the piston fires every time there is an event, won’t it just keep overwriting the first variable each time? Or make each individual variable in the piston the same value?

Or does using the brackets like below:

contactsensor.axisx[1]
contactsensor.axisx[2]
contactsensor.axisx[3]

pull in subsequent readings? I figured the “axisx” value could return only one value at any given time, which is why I was thinking it had to be captured periodically.

Thank you for your help, and forgive me if I’m missing something here—I’m still not quite clear on how to make this work.


#34

These are lists, or arrays, and I would avoid them unless the trigger count is identical each and every time…


Normally, yes… But there are likely workarounds if you use additional variables

This piston is going to be a real pain in the butt to code though, because the piston will run from top to bottom at each and every trigger. (meaning you will need code to direct the path differently each event, and make sure the entire piston can run top to bottom in less than 0.3 seconds)

Unfortunately, you can expect a high level of frustration with coding & testing this idea… While I do think it is possible, to be completely honest, it is not something that I’d want to tackle “off the clock”.

I hope you can understand…


#35

To simplify a bit, you should only need to monitor one of the three axis points. I’m not sure which one has the most extreme movement in your case, because it depends entirely on the position you installed the device.


#36

Absolutely—thank you for your time and help thus far. I’ll play around with it some more and see what I can come up with. Thank you.