Weather-door or window open warning piston isn't running


#1

1) Give a description of the problem
Simple warning to close open windows/doors open >x minutes when precip > some value

2) What is the expected behavior?
As above - warn when precip value >some value and door/window open >x minutes

3) What is happening/not happening?
Nothing - piston doesn’t run

4) Post a Green Snapshot of the pistonimage

I’m not sure why, but this piston isn’t running. To make testing easier I set the wait time for the open door/window down to 10 seconds (it’s set back to 5 minutes in the piston I uploaded) and set the precipitation level to >0 (today’s value is shown in the piston when I put in the weather expression is .02).

Then I open one of the monitored doors and waited the 10 seconds but nothing happens, piston doesn’t run.

Must be missing something obvious - appreciate any help w/this. Am I using the weather expression incorrectly, or ?


#2

Precip Today String is going to give you back a String value, and comparing that to a number may work alphabetically, but that’s probably not what you want. You might want to switch to Precip Today Inches instead as that will give you back a decimal number.

Beyond that though… In your mind, what’s the Event that causes this piston to run? How many times are you expecting it to run in a day? Just once, every five minutes, any time a contact is left open for more than 5 minutes? Because without knowing that it’s hard to give you any advice on how to proceed.

You may just want to monitor your contact sensors and if one of them is open past the threshold you check the weather to see if you need to send the announcement. Though you may find yourself getting spammed if you’ve got several windows and doors open.

Or you may want to just check the weather at certain times throughout the day and a piston to do that will look different that what you’ve got so far.

But some more details are needed in order to offer up a proper course of action.


#3

Great questions, really appreciate the context you provided. I was using rain as the initial trigger since it doesn’t rain much here (SoCal). But you’re right, I need to think more about how/when the piston runs, what level of messaging I want etc. Thanks! (And also for the string vs inches feedback as well.)


#4

Glad I got you thinking. :slight_smile:

Just so you know if you wanted to have Rain be the trigger, the way the weather service works, you’d really have to essentially poll the weather service every X minutes to see if there’s been a change. That’s potentially fraught with issues.

An easier approach could be to get a “leak sensor” and put it outside somewhere and use that as the trigger.

Or maybe there’s a personal weather station bit that I don’t know about that you could look into.

Beyond that though…you could always just check the forecast at times during the day to see if there’s a chance of rain and then react accordingly (if your windows and doors are open).


#5

Yeah, I think that checking the rain forecast at intervals may be the best way.

This one below looks like it could work, set if > 0 then warn if doors/windows open >5 min, and set it to run a few times a day.

Quantitative Precipitation Forecast - All Day

Syntax
$weather.forecast.forecast.simpleforecast.forecastday.qpf_allday

Returns
Returns the Quantitative Precipitation Forecast is the expected amount of melted precipitation accumulated over a specified time period. Add .mm or .in to the end for metric and imperial respectively.

Example
[[mm:0, in:0.00], [mm:0, in:0.00], [mm:0, in:0.00], [mm:0, in:0.00]]