Can't add a run schedule to a piston


#1

1) Give a description of the problem
Having already created a piston, I can’t figure out how to add a command to run it on a schedule, say for example every 4 hours, between 8AM and 10PM

2) What is the expected behavior?
I can add a command to run the piston on a schedule.

3) What is happening/not happening?
I can’t find an option to set a run schedule in the Virtual Devices options when trying to add a new condition. There is “Date” and “Date and Time” and “Time” in Virtual Devices options, but those only allow (as far as I can tell) setting a specific date and/or time, not a repeating schedule every X hours between x and x hours.

4) Post a Green Snapshot of the pistonimage

For example, how can I change the piston below to run on a schedule?


#2

You can setup a timer to do that.


#3

OMG…I went to that screen at least three times and somehow never saw the Timer option.

Time to get that brain-implant scheduled…

Thanks for the help, and for not saying “…, you dummy.” :wink:

I see a way to set it to run every four hours, but don’t see a way to tell it to run every 4 hours between 8 AM and 10 PM.

The only way I found to do it is w/separate statements, a Timer and a Time statement, per below. Is there a better way I’m not seeing?


#4

Do it that way You can use “restrictions” on many things, but restrictions on Timers work a bit differently, so for consistency sake it’s probably a good practice to just nest the IF statement inside the timer.

That way your restriction is evaluated every time the Timer IS run as opposed to every time the Timer WAS set.

I can explain that further if you like…but suffice to say, it makes a difference (on some pistons), so just get in the habit of doing it this way for Timers.


#5

If you change 4 hours into 240 minutes then you can select the hours you want it to run.

However setting this up, either like this or hours and restrictions, like this based on your example you could set it as happens daily at 8, 12pm, 4pm and 8pm


#6

Didn’t realize that was possible. Just changed one of my pistons as a result so that it now runs at :00 :15: :30 and :45 rather than just “every 15 minutes”.


#7

Thanks @Mike1616 & @c1arkbar.

@c1arkbar - I’m a little confused by the statement that by setting it to 240 minutes I can select the hours I want it to run.

Since my timer starts at 8:00 AM, and runs every 240 minutes, how is that different than it starting at 8:00 AM and running every 4 hours.

Clearly something went over my head here… :slight_smile:


#8

He means this:

Versus this:

Though you may have to tweak it a little to get the Timer to start out how you want it… When you set it up, you should see a countdown clock on the main dashboard. Just verify that it isn’t set for days in the future. You may find that the countdown “looks right” when you set it for Every 60 minutes, but only during the hours you choose.


#9

OK, thanks, I found the settings, but I am confused about how the two settings interact, how the “only during these hours” setting is different from the “Time is between 8:00 AM and 10:00 PM” setting in the if statement.

So…let’s say I set the interval as 240 minutes - that means the piston executes every 240 minutes between 8 AM and 10 PM.

If I then set the “only during these hours” setting to 8am, 12, 4 and 8pm, how does that affect how the piston runs? It seems like that would have no affect on the piston, since it is set to run every 4 hours (240 minutes), it would naturally run at 8, 12, 4, and 8, and then run out of time to run again due to the 10PM end time.

It seems like (if I get this at all) I would do is set the piston to run every 61 minutes, and then set the hours to run at the hours I want the piston to run between 8 and 10. So if I set the “Only during these hours” setting to 8, 1, 6, and 10, the piston would run at those times and then stop because the 61 minute setting would be past the allowed hour when the countdown ended. E.g., run at 8AM, count 61 minutes, oops, now it’s 9AM and I’m not allowed to run.

Am I TOTALLY LOST, or ? My head hurts…


#10

Functionally it’s not. It’s just another option for getting the same exact result.

The point was you could take out the IF where you check the time and use this method instead. Not that you’d continue to use both.

Correct. No affect the way you have it configured currently.

60, 61… Whatever it takes. (slight Mr. Mom reference there) :slight_smile:

Exactly.

No, you’ve got it. But as with most things in webCoRE, there are many ways to accomplish the same goal. Choose the one which makes your head hurt the least. :smile:


#11

@Mike1616 has hit every point I was trying to make.

One thing that I was saying with the happens daily st 8, 12, 4, 8 is that instead of trying to set up a timer for every whatever hours/minutes there is yet another way you could accomplish your goal.

There is a trigger in the conditions category under virtual devices/time called happens daily at

You can then select the exact time you would like this to trigger.

You then set multiple of these triggers into an OR group

If time happens daily at 8 am
OR
If time happens daily at 12 pm
OR
If time happens daily at 4 pm
OR
If time happens daily at 8 pm
Then
Do your actions
End if

This is probably the easier way to do things if you already know that you want it to run at specific times


#12

@c1arkbar & @Mike1616 - thanks! :slight_smile:

Appreciate you taking all the time to explain the somewhat obvious.

I had seen the “Happens daily at” option, but it only allows you to set one time. DIdn’t occur to me to just keep adding additional instances of that trigger for each time I wanted the piston to run. I would have been done days ago if I’d figured that out. <eek!> :smiley:

However, I ended up preferring to use the interval trigger, as that allows me to control all the time settings in one dialog, rather than having to create (and edit in the future) five separate instances of the “happens daily at” time settings. Less cluttered piston as well.

As usual, each new type of piston ends up as a good learning experience, thanks primarily to excellent folks like you two. Thanks very much for your help!!


#13

It sounds to me like you want it to re-remind you between the hours of 8 and 10 if a contact sensor remains open while switch 22 is on. Is that correct?
If so, there are several different ways to accomplish this. The easiest would be to create a while loop. Something like this:

That way, you are executing the same commands until either the window is closed or the switch is turned off. If either of those conditions are not met, then it would continue to execute. I haven’t tested this but it should work.


#14

Interesting - yeah, that would work.

The thing I get w/the timer mode is choosing exactly when it runs - I decided I don’t want it running every hour as in the past using another rain warning (via a SmartApp), when I’ve intentionally left a door open when rain was imminent or departing, I kept getting reminders that I didn’t need. The timer trigger w/the hours when it runs allows me to set specific times when it will run that are enough but not too much.

Thanks - I will put this piston in my pocket of ideas for other uses. :slight_smile:


#15

So, you’re trying to get a notification if you leave a window open and it’s raining? How are you accurately measuring if it’s raining? I know that the AccuWeather integration takes time to update so it could be pouring for a while before that updates.
If you run it on a timer it’s going to run as soon as it triggers once it will remind you all day. That’s how a timer works.


#16

I’m using a general all-day precip forcast statement (taken from the webCore Weather wiki):

$weather.forecast.forecast.simpleforecast.forecastday.qpf_allday.in

I think it’s good enough for where we are in SoCal where rain is infrequent and even when we have a door or window open it’s rare that there is enough wind w/the rain to cause significant water getting inside.


#17

I’m still confused what you are trying to accomplish with the Piston in the first place. If you are only using it to notify you if it’s going to rain and a door or window is left open, then you can leave the function of “stays open” for the contact sensor. Instead of asking how to get what you are trying to do to work, why don’t you state what you are trying to accomplish. There might be something that would accomplish the same thing a lot simpler.


#18

The piston is to replace a window open/rain warning smartapp I was using.

I didn’t like that the app wasn’t as finely controllable/customizable as I wanted, so hence creating a webCore piston.

The use case is I want warnings on days when there is rain that doors or windows are open, BUT, I only want a few warnings at specific times.

Current piston attached.