I have been reading up on creating threshold alarms for temp, humidity, etc and from what I have found it seems somewhat straightforward. What I would like more help on is finding and example code of this but with some delay on the push notifications so I don’t get a bunch of them every time my sensor updates (every minute). For example, if the temp falls below freezing, only send an notification every ‘x’ minutes. Any example code or detailed explanation would be helpful.
I would add a DateTime Item, at the point the temperature is below your treshold then update this with the actual date and a Switch item set to ON.
Add a rule in where - e.g. all 5 minutes - you check if the Switch item state is ON, then check if the refresh rate of your notifications is reached (e.g. 15 minutes) and send push, refresh the datetime item.
If the temerature treshold is above then set Switch to OFF.
This means “Does Send_via_App_Switch.state equal ON?” and it returns either true or false. And you don’t save the returned true/false so that line effectively does absolutely nothing.
Send_via_App_Switch.state = ON means “Assign the value ON to the variable Send_via_App_Switch” which is closer to what you want. But as the docs say, that’s not how you change the state of an Item. To change the state of an Item you use either postUpdate when you just want the Item to change or sendCommand when you want the device that is linked to that Item to do something.
You almost certainly want to use Send_via_App_Switch.sendCommand(ON).