Ok… let me see if I can cobble something together for you. The itch time I can’t seem to grab it from the gcal event so we will use the date time thing I showed earlier
Trying to figure out a piston using GCal Search (google calendar search)
This should do it. Tested and works here. Took me longer than thought. I learned a couple new things in process, . I paired it down from all the other stuff
Contact sensor 5 is your GCal event
White Bulb 4 is your Switch
THANK YOU, THANK YOU, THANK YOU! I’m playing with it now. I’m confident that I would have never figured that one out!
I’ll let you know if I run into any issues post any tweaks I may come up with !
If I want to set the piston state to display the next scheduled trigger time what would be the best way to do this?
looks like I messed something up?
12/8/2017, 7:59:55 AM +466ms
+1ms
╔Received event [gCal Mark Work Schedule Events].eventSummary = Next GCal Event: Work Schedule
+1ms
╔Calendar: Work Schedule
+1ms
╔Event Start: Fri, Dec 08 11:00 AM
+1ms
╔Event End: Fri, Dec 08 11:30 AM
+2ms
╔ with a delay of 121ms
+83ms
║RunTime Analysis CS > 19ms > PS > 42ms > PE > 23ms > CE
+94ms
║Runtime (39650 bytes) successfully initialized in 42ms (v0.2.0ff.20171129) (92ms)
+95ms
║╔Execution stage started
+102ms
║║Cancelling statement #11’s schedules…
+344ms
║║Calculating (error) Invalid parameters. Expecting indexOf(stringOrDeviceOrList, substringOrItem) + (integer) 12 >> (error) Invalid parameters. Expecting indexOf(stringOrDeviceOrList, substringOrItem)12
+348ms
║║Calculating (string) + (string) 2017 >> (string) 2017
+367ms
║║Calculating (error) Invalid parameters. Expecting indexOf(stringOrDeviceOrList, substringOrItem) + (integer) 19 >> (error) Invalid parameters. Expecting indexOf(stringOrDeviceOrList, substringOrItem)19
+371ms
║║Calculating (string) java.lang.ClassCastException + (string) , >> (string) java.lang.ClassCastException,
+373ms
║║Calculating (string) java.lang.ClassCastException, + (string) >> (string) java.lang.ClassCastException,
+381ms
║║Executed virtual command [Scene Mark Wake-up].waitForDateTime (4ms)
+604ms
║║Executed physical command [Scene Mark Wake-up].push() (222ms)
+605ms
║║Executed [Scene Mark Wake-up].push (223ms)
+607ms
║╚Execution stage complete. (513ms)
+608ms
║Setting up scheduled job for Fri, Dec 8 2017 @ 8:03:21 AM AKST (in 205.366s)
+628ms
╚Event processed successfully (629ms)
12/8/2017, 7:58:21 AM +173ms
+1ms
╔Received event [gCal Mark Work Schedule Events].eventSummary = Next GCal Event: Work Schedule
+1ms
╔Calendar: Work Schedule
+1ms
╔Event Start: Fri, Dec 08 11:00 AM
+1ms
╔Event End: Fri, Dec 08 11:30 AM
+1ms
╔ with a delay of 79ms
+360ms
║RunTime Analysis CS > 24ms > PS > 315ms > PE > 21ms > CE
+370ms
║Piston waited at a semaphore for 268ms
+372ms
║Runtime (39718 bytes) successfully initialized in 315ms (v0.2.0ff.20171129) (370ms)
+373ms
║╔Execution stage started
+380ms
║║Cancelling statement #11’s schedules…
+491ms
║║Calculating (error) Invalid parameters. Expecting indexOf(stringOrDeviceOrList, substringOrItem) + (integer) 12 >> (error) Invalid parameters. Expecting indexOf(stringOrDeviceOrList, substringOrItem)12
+495ms
║║Calculating (string) + (string) 2017 >> (string) 2017
+514ms
║║Calculating (error) Invalid parameters. Expecting indexOf(stringOrDeviceOrList, substringOrItem) + (integer) 19 >> (error) Invalid parameters. Expecting indexOf(stringOrDeviceOrList, substringOrItem)19
+518ms
║║Calculating (string) java.lang.ClassCastException + (string) , >> (string) java.lang.ClassCastException,
+520ms
║║Calculating (string) java.lang.ClassCastException, + (string) >> (string) java.lang.ClassCastException,
+527ms
║║Executed virtual command [Scene Mark Wake-up].waitForDateTime (3ms)
+675ms
║║Executed physical command [Scene Mark Wake-up].push() (146ms)
+676ms
║║Executed [Scene Mark Wake-up].push (148ms)
+678ms
║╚Execution stage complete. (305ms)
+679ms
║Setting up scheduled job for Fri, Dec 8 2017 @ 8:03:21 AM AKST (in 299.588s)
+699ms
╚Event processed successfully (698ms)
I think I see it. In that big wit statement, there are four parts that reference [Test Events:EventsSummary]
You need to change that to your GCal event name. So change the Test Events part to your GCal event name. Leave the :EventSummary part alone
ok, I fixed the “test events” issues. But now it seems the piston is triggering the lamp scene everytime it checks for status change.
12/8/2017, 11:58:08 AM +873ms
+2ms
╔Received event [gCal Mark Work Schedule Events].eventSummary = Next GCal Event: Work Schedule
+2ms
╔Calendar: Work Schedule
+2ms
╔Event Start: Fri, Dec 08 10:00 AM
+2ms
╔Event End: Fri, Dec 08 08:00 PM
+2ms
╔ with a delay of 488ms
+375ms
║RunTime Analysis CS > 17ms > PS > 306ms > PE > 52ms > CE
+391ms
║Piston waited at a semaphore for 267ms
+393ms
║Runtime (42467 bytes) successfully initialized in 306ms (v0.2.0ff.20171129) (390ms)
+394ms
║╔Execution stage started
+399ms
║║Cancelling statement #11’s schedules…
+413ms
║║Calculating (integer) 63 + (integer) 12 >> (integer) 75
+416ms
║║Calculating (string) Dec 08 + (string) 2017 >> (string) Dec 08 2017
+424ms
║║Calculating (integer) 63 + (integer) 19 >> (integer) 82
+428ms
║║Calculating (string) Thu, Dec 7 2017 + (string) , >> (string) Thu, Dec 7 2017,
+429ms
║║Calculating (string) Thu, Dec 7 2017, + (string) 10:00 AM >> (string) Thu, Dec 7 2017,10:00 AM
+435ms
║║Executed virtual command [Scene Mark Wake-up].waitForDateTime (1ms)
+1441ms
║║Executed physical command [Scene Mark Wake-up].push() (1005ms)
+1442ms
║║Executed [Scene Mark Wake-up].push (1007ms)
+1444ms
║╚Execution stage complete. (1050ms)
+1445ms
║Setting up scheduled job for Fri, Dec 8 2017 @ 12:03:06 PM AKST (in 296.558s)
+1462ms
╚Event processed successfully (1462ms)
12/8/2017, 11:58:06 AM +245ms
+0ms
╔Received event [Home].time = 1512766686875 with a delay of -630ms
+94ms
║RunTime Analysis CS > 16ms > PS > 35ms > PE > 43ms > CE
+104ms
║Runtime (42165 bytes) successfully initialized in 35ms (v0.2.0ff.20171129) (103ms)
+105ms
║╔Execution stage started
+112ms
║║Cancelling statement #8’s schedules…
+2569ms
║║Executed physical command [gCal Mark Work Schedule Events].refresh() (2454ms)
+2569ms
║║Executed [gCal Mark Work Schedule Events].refresh (2455ms)
+2586ms
║║Calculating (integer) 63 + (integer) 12 >> (integer) 75
+2601ms
║║Calculating (integer) 63 + (integer) 19 >> (integer) 82
+2604ms
║║Calculating (string) Next scheduled shift start: + (string) Dec 08 >> (string) Next scheduled shift start: Dec 08
+2605ms
║║Calculating (string) Next scheduled shift start: Dec 08 + (string) 2017 >> (string) Next scheduled shift start: Dec 08 2017
+2607ms
║║Calculating (string) Next scheduled shift start: Dec 08 2017 + (string) >> (string) Next scheduled shift start: Dec 08 2017
+2608ms
║║Calculating (string) Next scheduled shift start: Dec 08 2017 + (string) 10:00 AM >> (string) Next scheduled shift start: Dec 08 2017 10:00 AM
+2610ms
║║Executed virtual command [gCal Mark Work Schedule Events].setState (1ms)
+2612ms
║╚Execution stage complete. (2507ms)
+2613ms
║Setting up scheduled job for Fri, Dec 8 2017 @ 12:03:06 PM AKST (in 298.017s)
+2629ms
╚Event processed successfully (2628ms)
12/8/2017, 11:53:28 AM +4ms
+0ms
╔Received event [gCal Mark Work Schedule Events].eventSummary = Next GCal Event: Work Schedule
+0ms
╔Calendar: Work Schedule
+0ms
╔Event Start: Fri, Dec 08 10:00 AM
+0ms
╔Event End: Fri, Dec 08 08:00 PM
+1ms
╔ with a delay of 131ms
+67ms
║RunTime Analysis CS > 15ms > PS > 24ms > PE > 29ms > CE
+78ms
║Runtime (42398 bytes) successfully initialized in 24ms (v0.2.0ff.20171129) (76ms)
+78ms
║╔Execution stage started
+84ms
║║Cancelling statement #11’s schedules…
+96ms
║║Calculating (integer) 63 + (integer) 12 >> (integer) 75
+100ms
║║Calculating (string) Dec 08 + (string) 2017 >> (string) Dec 08 2017
+107ms
║║Calculating (integer) 63 + (integer) 19 >> (integer) 82
+110ms
║║Calculating (string) Thu, Dec 7 2017 + (string) , >> (string) Thu, Dec 7 2017,
+111ms
║║Calculating (string) Thu, Dec 7 2017, + (string) 10:00 AM >> (string) Thu, Dec 7 2017,10:00 AM
+116ms
║║Executed virtual command [Scene Mark Wake-up].waitForDateTime (2ms)
+844ms
║║Executed physical command [Scene Mark Wake-up].push() (727ms)
+845ms
║║Executed [Scene Mark Wake-up].push (729ms)
+847ms
║╚Execution stage complete. (769ms)
+848ms
║Setting up scheduled job for Fri, Dec 8 2017 @ 11:58:06 AM AKST (in 278.023s)
+866ms
╚Event processed successfully (865ms)
Here is my latest tweak to the piston (added a piston state showing next scheduled event start time)
I had this too. I will post when I get home. Teaching daughter to drive. New temps today and it’s her time. I did fix though
Ok. Here you go, need to ad a restriction to the on events part of the piston. Only when Gcal event is off . That way it will set the timer for the correct on time for the light.
I believe that should fix it.
[update]. Nope still not right. Sorry. Still working on it
Ok. Had to redo this thing. I think I got it.
2 pistons, one to refresh gCal event every 5 minutes to find any changes to your scheduled calendar event
And one to do the heavy lifting
Again change the test Events part to your gCal event name
Fingers crossed it works as expected
Let me know results. Thanks for being patient
Gopack2
Holiday Piston Community Standard
Seems the calculations for start date are still coming up with yesterday? Even though the start time is showing correctly?
+2ms
╔Received event [gCal Mark Work Schedule Events].eventSummary = Next GCal Event: Work Schedule
+2ms
╔Calendar: Work Schedule
+2ms
╔Event Start: Sat, Dec 09 09:00 AM
+2ms
╔Event End: Sat, Dec 09 06:00 PM
+2ms
╔ with a delay of 118ms
+112ms
║RunTime Analysis CS > 30ms > PS > 53ms > PE > 29ms > CE
+119ms
║Runtime (42624 bytes) successfully initialized in 53ms (v0.2.0ff.20171129) (117ms)
+120ms
║╔Execution stage started
+130ms
║║Comparison (enum) closed is (string) closed = true (1ms)
+131ms
║║Condition #17 evaluated true (7ms)
+135ms
║║Comparison (string) Next GCal Event: Work Schedule
+135ms
║║Calendar: Work Schedule
+135ms
║║Event Start: Sat, Dec 09 09:00 AM
+135ms
║║Event End: Sat, Dec 09 06:00 PM
+135ms
║║ is_not (string) No events found = true (0ms)
+136ms
║║Condition #29 evaluated true (4ms)
+137ms
║║Condition group #1 evaluated true (state did not change) (14ms)
+138ms
║║Cancelling statement #2’s schedules…
+153ms
║║Calculating (integer) 63 + (integer) 12 >> (integer) 75
+157ms
║║Calculating (string) Dec 09 + (string) 2017 >> (string) Dec 09 2017
+163ms
║║Executed virtual command [gCal Mark Work Schedule Events].setVariable (4ms)
+170ms
║║Calculating (integer) 63 + (integer) 19 >> (integer) 82
+175ms
║║Executed virtual command [gCal Mark Work Schedule Events].setVariable (2ms)
+177ms
║║Cancelling statement #25’s schedules…
+185ms
║║Calculating (string) Fri, Dec 8 2017 + (string) , >> (string) Fri, Dec 8 2017,
+187ms
║║Calculating (string) Fri, Dec 8 2017, + (string) 9:00:00 AM AKST >> (string) Fri, Dec 8 2017, 9:00:00 AM AKST
+192ms
║║Executed virtual command [Scene LR Daytime].setState (0ms)
+199ms
║║Calculating (string) Fri, Dec 8 2017 + (string) , >> (string) Fri, Dec 8 2017,
+202ms
║║Calculating (string) Fri, Dec 8 2017, + (string) 9:00:00 AM AKST >> (string) Fri, Dec 8 2017, 9:00:00 AM AKST
+208ms
║║Executed virtual command [Scene LR Daytime].waitForDateTime (2ms)
+421ms
║║Executed physical command [Scene LR Daytime].on() (212ms)
+422ms
║║Executed [Scene LR Daytime].on (213ms)
+423ms
║╚Execution stage complete. (304ms)
+430ms
╚Event processed successfully (430ms)
12/9/2017, 7:43:10 AM +38ms
+1ms
╔Received event [gCal Mark Work Schedule Events].eventSummary = Next GCal Event: Work Schedule
+1ms
╔Calendar: Work Schedule
+1ms
╔Event Start: Sat, Dec 09 09:00 AM
+1ms
╔Event End: Sat, Dec 09 06:00 PM
+1ms
╔ with a delay of 80ms
+64ms
║RunTime Analysis CS > 13ms > PS > 25ms > PE > 26ms > CE
+71ms
║Runtime (42622 bytes) successfully initialized in 25ms (v0.2.0ff.20171129) (69ms)
+72ms
║╔Execution stage started
+83ms
║║Comparison (enum) closed is (string) closed = true (1ms)
+84ms
║║Condition #17 evaluated true (8ms)
+88ms
║║Comparison (string) Next GCal Event: Work Schedule
+88ms
║║Calendar: Work Schedule
+88ms
║║Event Start: Sat, Dec 09 09:00 AM
+88ms
║║Event End: Sat, Dec 09 06:00 PM
+88ms
║║ is_not (string) No events found = true (1ms)
+89ms
║║Condition #29 evaluated true (4ms)
+90ms
║║Condition group #1 evaluated true (state did not change) (14ms)
+92ms
║║Cancelling statement #2’s schedules…
+100ms
║║Calculating (integer) 63 + (integer) 12 >> (integer) 75
+104ms
║║Calculating (string) Dec 09 + (string) 2017 >> (string) Dec 09 2017
+108ms
║║Executed virtual command [gCal Mark Work Schedule Events].setVariable (2ms)
+115ms
║║Calculating (integer) 63 + (integer) 19 >> (integer) 82
+120ms
║║Executed virtual command [gCal Mark Work Schedule Events].setVariable (1ms)
+122ms
║║Cancelling statement #25’s schedules…
+133ms
║║Calculating (string) Fri, Dec 8 2017 + (string) , >> (string) Fri, Dec 8 2017,
+135ms
║║Calculating (string) Fri, Dec 8 2017, + (string) 9:00:00 AM AKST >> (string) Fri, Dec 8 2017, 9:00:00 AM AKST
+139ms
║║Executed virtual command [Scene LR Daytime].setState (0ms)
+147ms
║║Calculating (string) Fri, Dec 8 2017 + (string) , >> (string) Fri, Dec 8 2017,
+149ms
║║Calculating (string) Fri, Dec 8 2017, + (string) 9:00:00 AM AKST >> (string) Fri, Dec 8 2017, 9:00:00 AM AKST
+152ms
║║Executed virtual command [Scene LR Daytime].waitForDateTime (0ms)
+292ms
║║Executed physical command [Scene LR Daytime].on() (139ms)
+293ms
║║Executed [Scene LR Daytime].on (140ms)
+295ms
║╚Execution stage complete. (223ms)
+304ms
╚Event processed successfully (304ms)
What is the next scheduled showing in the piston quick facts. Don’t look at the variables. If the event is no longer valid or expired it will have a description of ‘ no events found’. Then the piston won’t trigger any longer until there is a valid event description. It doesn’t clear the old dates until it finds a new event date. What we are really concerned with is the next scheduled event. If that is empty it will not turn on any lights. If it is filled in then the lights will turn on at that time
The quick facts (section under variable definitions) is showing next date as 12/08/17 but the next start time is showing correctly with 12/09/17’s start time.
That’s what we are concerned with. As log as that next start time is set for the correct time to turn on lights, your stuff should work properly. If you go into the smartthings app and open your gcal event what does it say in the description box? Is there a new event that hasn’t occurred yet?
Does it look like this?
That means no more scheduled events in google calendar and variables won’t change
If it looks like this
Then the variables should have changed to reflect that info
What we are most concerned with is this is set correctly to right time
Checked everything you asked about.
- Smartthings app shows next event as 12:00pm 12/10/17 (correct)
- Logs match above
- Quick Facts show next scheduled “never”
- Log variables show start time 12:00am (instead of PM) and date 12/09/17 (instead of 12/10/17)
Piston turns on light on every run I assume because the event is showing in the past?