You bet!
Dog Door Tracking - Restricting Triggers
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:
- 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.
- 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ā¦
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ā¦
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?
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.
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ā¦
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.
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.
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ā¦
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.
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.