Trigger an action 5 minutes before "GCal Search" event


#1

1) Give a description of the problem
I don’t know how to setup a piston that can trigger an action 5 minutes before “GCal Search” event

2) What is the expected behavior?
I would like to trigger an action 5 minutes before “GCal Search” event
Then using Harmony run activity when event happens.

3) What is happening/not happening?
I have notification playing at the time that event happens. Want it to be 5 minutes before.

4) Post a Green Snapshot of the pistonimage


#2

Could you please explain what is going on in this piston. Define what the devices are please


#3

I am using GCal Search to look at a calendar for when sporting events start and end.

When sporting events starts the presence created by GCal Search turns on and triggers a Harmony Activity switch and plays audio to a speaker.

I would like to play the audio a few minutes before the presence created by GCal Search turns on.


#4

Presence Sensor 1 = My phone
Presence Sensor 2 = Wife’s phone
Presence Sensor 3 = GCal Search Virtual Presence Sensor
Presence Sensor 4 = GCal Search Virtual Presence Sensor
Presence Sensor 5 = GCal Search Virtual Presence Sensor
Presence Sensor 6 = GCal Search Virtual Presence Sensor
Switch 26 = Harmony Activity
Switch 27 = Harmony Activity
Switch 28 = Harmony Activity


#5

In the ST IDE can you share what the current states are of the GCal Search Virtual Presence Sensor would be? (From the IDE click on devices and then select the device and scroll down to current states)

I am unfamiliar with the GCal Search. So my knowledge is limited to what webcore can do. However if I know what kind of data is being produced I might better be able to offer a solution.

Off hand do you know if this data is loaded in and it triggers the presence sensor because it already knows the time it is expected? Might be able to just do a simple addMinutes($data, ‘-5’) function


#6

It does provide the time and date ahead of time.
Maybe we can use (“ArriveTime” -5).
I just don’t know how to formulate it. Have never used a variable in any of my pistons. Thanks for your help.


#7

create a new piston. add a new statement. Just leave it as location. Choose log to console. Change type to error, change the value to expression. In the expression editor type [device name:eventSummary] When you start typing the device name it should autocomplete it. Then it might not autocomplete the eventSummary part but that is ok. If it displays that info as it does above then try wrapping time() around the above statement so it looks like time([device name:eventSummary])


#8

How do I choose “Log to console”?


#9

When it asks for device it defaults to “Location”. Just click next/add/continue (cant recall off the top of my head) and then in the next menu you can find “Log to console…”


#10

After clicking on New Statement I have the following options.
If Block
Action
Timer
Switch
Do block
On event
Etc…


#11

Sorry I accidentally deleted a portion. Click action


#12

I see it now.
So you think it will be best to use eventSummary instead of arrivalTime?


#13

Sorry I didnt realize it was cutting off that image. I only saw the first couple data points. Looks like arrive time is only for the day. Unless the game is happening at midnight?


#14

Looks like you are right. It’s just being used for the date. I think the date is also important in this case.
Without the date and only time wouldn’t run the Piston everyday at that time?


#15

it was mainly just a test to see if it would extract the time from that string. I am leaning towards it probably will not. but you could always use the datetime() function but it doesnt really have the full datetime in that eventSummary. So it would be a hack of getting the date from the arrive and the time from there if its possible


#16

I read this on the GCal Search thread. Maybe it will be helpful. They mention its possible in Core. No mention of Webcore.



#17

I used ifttt to add another event 45 minutes before the actual event. So now I don’t have to worry about the date. This is what I got. Any other suggestions?


#18

With this new event can you setup a trigger like you originally did?


#19

I can trigger like I have been doing via the presence. Not sure if I can do it with the expression. Wouldn’t know how to formulate it.


#20

In order to use an expression we need to be able to extract the time/date from the message. But I don’t think it will be possible.