Is there a better way to do this?


#1

So in resume this piston turns on the light in the best room at 6h02 AM during the week and at 9h30 AM during the weekend if the location mode is night.

My issue tho is i do not want that piston to run during my vacations or during holidays.

Next holidays for us are

May 21
June 25
July 2nd
September 3

And our vaction are from June 29 to July 15 inclusively.

So I made the only when to filter the dates, is this a good way to do this or is there a better way to do this?

Thanks


#2

Could you just create a virtual switch called vacation. Then set the piston to not run when vacation switch is on.

Then it would be usable and you wouldn’t have to edit it any more. Just turn on the switch.

You could possibly get the Gcal app set up. Have events in your Google calendar that say on vacation, or vacation mode, or this switch. Grab those events in Gcal then use Webcore to say when the gacal event switch is on don’t do lights. Similar to a virtual switch you toggle yourself.


#3

But is my actual method that i posted ok?

Like will it work?

I plan to add more lines and make sure it’s a logical OR and not an AND


#4

It looks like it should, but I would wait for one of the Webcore minions to answer.

Sorry, I’m just not an expert at Webcore myself. It looks right to me.


#5

Not sure this will work… What is triggering the code for lines 19-35?
I see the triggers/timers for the “every day at…” but nothing for the first block of code.


#6

Another option you can consider, create a Vacation mode in ST.


#7

yeah but im trying to atuomate as much as possible

I’m scared to forget to turn on vacation location mode


#8

I need to adjust that but for line 19-35 technicly what happens is

In another piston i have a Virtual switch that reacts when i tell Alexa good morning

So if i say Alexa Good morning, the other piston turns the virtual switch on, and change the location to home, (so then line 19-35 fire)

So that shouldn’t be an issue since i won’t be home to tell alexa good morning :stuck_out_tongue:


#9

What if you just make the system default to vacation mode if you’re not home at 3am, or not home at 3am for the 2nd day in a row?


#10

Because in my 2 weeks vacation i’ll still have 3-4 days straight at home

So i don’t want it to fire


#11

I added a new line for it not to run between April 21 and April 21 2018

And sadly the rule ran this morning at 9h30 :frowning:

Not sure how to fix this


#12

I am a newbie just so you know:)))
What I would do is, create another piston to pause and resume this one on the holidays you have.

IF date changes to (your vacation date)
pause piston good morning
IF date changes to (when your vacation ends)
Resume piston good morning

you can add as many dates as you want


#13

I agree with this as an overall plan for any pistons that may need to be adjusted due to temporarily changing schedules, etc. I write pistons that need it, to use virtual switches or variables that either allow or disallow certain actions. You could also call them override switches or flags.

For example, I have many of my lights throughout the house running on a mixture of schedule, lux and motion. Each of the controlling pistons looks at the state of a “Prevent Lights Flag” virtual switch. If that switch is on, no automations run. I can turn that switch on manually, by voice or programmatically. For Halloween, I have another piston that turns the “Prevent Lights Flag” switch on if no one is home on Halloween around sunset. This lets trick-or-treaters know that we’re not home to hand out candy. Then, if we come back home or at 22:00, the flag switch is turned off so that the automations can restart.

So, in short, pistons automate and virtual switches or global variables allow override capabilities.

BTW, as kinda mentioned above, an added added advantage of virtual (simulated) switches is that they’re voice controllable via Alexa or Google Home too.


#14

How would I do this?

The if date is this then pause this said piston?


#15

I think your “Only When” date restriction at the top of the piston isn’t acting on your “Do Every” weekday/weekend sections later on.


#16

This is a section of one of my pistons that calculates the time to turn off the Christmas lights based on certain dates.

In your case, you can change the dates, add as many others as you like and also make date ranges too. Then instead of setting a time variable, have the piston that has these statements in it either pause (or not) your piston above.


#17

It ran because there are no dates between the 21st and 21st. If you set it to “between the 21st and 22nd” it would not run on the 21st and it would resume on the 22nd.

Using ‘between’ statements you have to imagine there is an “at midnight” suffix on your date. Then it’ll work the way you want it to.


#18

Make sense i’ll try this

I though that between april 21 midnight and april 21 11h59 PM would work byt guess not