So I’ve got this piston I’d like to keep track of high and low temperatures - morning historical but daily notifications so far. Everyday I’m going to send notifications and set piston state, but also somehow need to reset variables so they capture new temperature data. How can I accomplish this?
Resetting variables?
Personally, I hardly ever reset my variables.
(since they re-write using the new data each time the piston runs)
That being said, if you really want to reset the variables, I would use an arbitrary number (that is not zero). Something like 200 would work great in this case. This way, if the notification ever comes thru with that variable, then you know there is an issue with your piston or device.
Someone in one of the Facebook groups had a good idea for this particular instance - reset the variable to the current temperature. 200 would’ve been too high because the temperature would never go that high.
That would work as well. The reason I picked 200 is because the temp never goes that high. In other words, if the notification displays 200, you know something is wrong. Any other number, you know the data is correct. If you reset it to the current temp, it will be harder to tell if there are any issues.
@WCmore So here’s that piston I was trying to do capturing high and low temperatures on a daily basis. Piston B isn’t working whether the variable is decimal or even dynamic. Here’s what it’s showing for today in the variables up top for highs and lows but the actual temperatures are 74.3 for a high and 72.2 for the low so far. How can I fix this?
How to design piston that’ll capture minimum/maximum data
From what I can see, that looks like a very efficient piston.
(as long as you are ‘resetting’ the variables every day)
Also, now that you added "IF temp rises above variable"
, you should not use 200 to reset the high, because it will never reach that number, so no new data will ever be written to it.
If it were me, once a day I would probably reset my high variable to 1, and my low variable to 101. This will clear the previous days data, and guarantee that the first data pull on the new day will overwrite it.
As far as why your variables are always whole numbers:
I have noticed in the past that sometimes, when I change a variable from an integer to a decimal at a later time, it remains ‘stuck’ as integers. (even though the piston shows decimal, the stored data may always be an integer) The only solution I found in those cases is to create a new variable with a different name, and assign it as a decimal from the very beginning.
Either that, or some devices only report the temperature in whole numbers.
Your mileage may vary. It is too unreliable for me to recommend that method.
I think setting high to 1 and low to 101 is flawless as a reset. It clears the old data, and will be over written the very next time the temp comes in. I think it is a great way to make sure the new day’s data is correct, because if those numbers ever come thru in a notification, then you know there is an issue with the piston or data pull.
So, if a piston trigger changes state during a WAIT and starts again from the top, do defined variables get reset as well?
Seriously, the number one rule I follow with variables
is:
I only define up top IF the variable
changes very very infrequently.
(and when it does, I change it manually)
98% of my variables
are set inside the body of the piston.
(IE: I want total control of when they change)