> Is there a way to detect if a calendar event is all-day or not?
There is a 'all day event' option in the action / app / test app / calender all day event.
> Is there a way to detect if a calendar event is all-day or not?There is a 'all day event' option in the action / app / test app / calender all day event.
--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/rx9DG2wzk8M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.
> I see 'calendar entry: all day yes/no flag' is on Pent's to-do list, though how do I simulate until then?
>
Could you explain what you would like to do?
And post your profile description.
To post your profile or task here... Long press on the profile or task name / ( 3 dot menu with 4.0+ ) export / export "DESCRIPTION" to clipboard (not XML)
Any linked tasks will be exported with the profile they are linked to..
To be able to export, The beginner mode needs to be off and the profile needs to be named by you (Not the Tasker listed name. Tasker will list your profile with the context name if you have not given it one).
--
The issue I see is if you have a 'all day' event then your calendar context will now be true for the entire day. So when you get to work the context will fire, You check to see if it is a 'all day' event and stop the task, now the context will be true for the rest of the work day and not refire when you get a 'non all day' event.
I did some searching and did not find a work around for this particular issue. The easiest way would be to set all of your 'all day' events with a certain flag in the title, then you could use the pattern matching of the title to filter them out. However for someone like myself who has a acute case of CRS (can't remember shit) I would always forget what the flag was or even to use it.
So I have come up with this approach. It uses the tasker variable %CALTITLE as the trigger. So far in the preliminary tests this is working. The test profile is below.
The way it works is to monitor if %Title1 matches %CALTITLE. The following is From the guide.
Calendar Event Title / Descr / Location %CALTITLE / %CALDESCR / %CALLOC
The title, description and location of the current calendar event, if there is one.
"****If there are multiple current calendar events the variables refer to the shortest. "*****
Tip: find other details about the current event(s) using the Misc / Test action, specifying %TIMES for the data
So if you have a 'all day' event already active then %CALTITLE will contain that title, but when a event with a start and end time becomes active then %CALTITLE will change to that title and that is what triggers the profile. Then the task just checks to see if there is any 'non all day' events active and acts accordingly.
I have not tested all the different scenarios so it is still a work in progress, but this should get you started.
In addition to the following profile You will need a Dummy profile with a state / app / calendar context to set the %CALTITLE
Profile: Cal Main (779)
State: Variable Value [ %Title1 !~ %CALTITLE ]
Enter: Anon (780)
A1: Test App [ Type:Calendar All Day Data:%TIMES Store Result In:%cal_allday Continue Task After Error:On ]
A2: If [ %cal_allday(:) !~ *no* ]
A3: Variable Set [ Name:%Title1 To:%CALTITLE Do Maths:Off Append:Off ]
A4: Notify [ Title:Cal All Day Cancel %TIME Text: Icon:null Number:0 Permanent:Off Priority:3 ]
A5: Stop [ With Error:Off Task: ]
A6: End If
A7: Notify [ Title:Cal Event Triggered %TIME Text: Icon:null Number:0 Permanent:Off Priority:3 ]
A8: Variable Set [ Name:%Title1 To:%CALTITLE Do Maths:Off Append:Off ]
> So I have come up with this approach. It uses the tasker variable %CALTITLE as the trigger. So far in the preliminary tests this is working. The test profile is below.
After more testing this approach has a issue with screen off monitoring. There can be significant delay between the time of the event and the profile activation. The worst I found was 6 min.
I believe a better approach will be to dynamically add a " 'Not' Title " to the calendar context if the Title is a 'all day' event. So in your calendar context in the Title field you would have a global variable with a original value of "*" then if the calendar title (First all day) that has just fired the context is a 'all day' event you would set the variable to "!First all day". And if another all day event is added (Second all day) then you would set it to "!First all day/Second all day"
I should have something put together within a few days, unless someone beats me to it...
Rich..
Thanks, Rich. I'm traveling so haven't had an opportunity to play around with this.
--
> I should have something put together within a few days, unless someone beats me to it...
Ok, Here is what I came with. This approach requires 3 profiles.
1-"Calendar Main" triggers on every calendar event then adds that event name to its 'ignore' list so even if it is a all day event it will fire on the next calendar event. If the event is 'not' a all day event it will set a global variable to trigger the 'Calendar Timed Event' profile that will trigger on any timed event.
2- "Calendar Timed Events" will trigger on any Timed (Not all day) events
3- "Calendar All Off" is needed to reset %All_day_array when "All" Calendar events Stop.
Profile: Calender Main (777)
State: Calendar Entry [ Title:%All_day_arr Location:* Description:* Available:Any Calendar:Google:ricp...@gmail.com ]
Enter: Anon (778)
<on>
A1: Anchor
A2: Test App [ Type:Calendar All Day Data:%TIMES Store Result In:%cal_allday Continue Task After Error:On ]
A3: Test App [ Type:Calendar Title Data:%TIMES Store Result In:%cal_title Continue Task After Error:On ]
A4: [X] Flash [ Text:%cal_allday(:) Long:Off ]
A5: For [ Variable:%index Items:1:%cal_title(#) ]
A6: If [ %All_day_arr !~ *%cal_title(%index)* ]
A7: Variable Set [ Name:%All_day_arr To:! Do Maths:Off Append:Off ] If [ %All_day_arr ~R \* ]
A8: Variable Set [ Name:%All_day_arr To:/%cal_title(%index) Do Maths:Off Append:On ]
A9: Variable Set [ Name:%Timed_cal To:/%cal_title(%index) Do Maths:Off Append:On ] If [ %cal_allday(%index) ~ no ]
A10: End If
A11: End For
A12: [X] Flash [ Text:%All_day_arr Long:Off ]
Profile: Calendar All Off (779)
State: Calendar Entry [ Title:* Location:* Description:* Available:Any Calendar:Google:ricp...@gmail.com ]
Enter: Anon (780)
A1: Notify [ Title:Active Events All On %TIME Text: Icon:null Number:0 Permanent:Off Priority:3 ]
Exit: Anon (784)
A1: Notify [ Title:No Active Events All Off %TIME Text: Icon:null Number:0 Permanent:Off Priority:3 ]
A2: Variable Set [ Name:%All_day_arr To:* Do Maths:Off Append:Off ]
Profile: Calendar Timed Events (776)
State: Calendar Entry [ Title:%Timed_cal Location:* Description:* Available:Any Calendar:Google:ricp...@gmail.com ]
Enter: Anon (785)
A1: Notify [ Title:Timed Calendar Event Ran %TIME Text: Icon:null Number:0 Permanent:Off Priority:3 ]
Exit: Anon (786)
A1: Notify [ Title:Timed Events Stopped %TIME Text: Icon:null Number:0 Permanent:Off Priority:3 ]
A2: Variable Clear [ Name:%Timed_cal Pattern Matching:Off ]
A3: Variable Set [ Name:%All_day_arr To:* Do Maths:Off Append:Off ]
> I should have something put together within a few days, unless someone beats me to it...Ok, Here is what I came with. This approach requires 3 profiles.
1-"Calendar Main" triggers on every calendar event then adds that event name to its 'ignore' list so even if it is a all day event it will fire on the next calendar event. If the event is 'not' a all day event it will set a global variable to trigger the 'Calendar Timed Event' profile that will trigger on any timed event.
2- "Calendar Timed Events" will trigger on any Timed (Not all day) events
3- "Calendar All Off" is needed to reset %All_day_array when "All" Calendar events Stop.
Profile: Calender Main (777)
State: Calendar Entry [ Title:%All_day_arr Location:* Description:* Available:Any Calendar:Goo...@gmail.com ]
Enter: Anon (778)
<on>
A1: Anchor
A2: Test App [ Type:Calendar All Day Data:%TIMES Store Result In:%cal_allday Continue Task After Error:On ]
A3: Test App [ Type:Calendar Title Data:%TIMES Store Result In:%cal_title Continue Task After Error:On ]
A4: [X] Flash [ Text:%cal_allday(:) Long:Off ]
A5: For [ Variable:%index Items:1:%cal_title(#) ]
A6: If [ %All_day_arr !~ *%cal_title(%index)* ]
A7: Variable Set [ Name:%All_day_arr To:! Do Maths:Off Append:Off ] If [ %All_day_arr ~R \* ]
A8: Variable Set [ Name:%All_day_arr To:/%cal_title(%index) Do Maths:Off Append:On ]
A9: Variable Set [ Name:%Timed_cal To:/%cal_title(%index) Do Maths:Off Append:On ] If [ %cal_allday(%index) ~ no ]
A10: End If
A11: End For
A12: [X] Flash [ Text:%All_day_arr Long:Off ]
Profile: Calendar All Off (779)
State: Calendar Entry [ Title:* Location:* Description:* Available:Any Calendar:Goo...@gmail.com ]
Enter: Anon (780)
A1: Notify [ Title:Active Events All On %TIME Text: Icon:null Number:0 Permanent:Off Priority:3 ]
Exit: Anon (784)
A1: Notify [ Title:No Active Events All Off %TIME Text: Icon:null Number:0 Permanent:Off Priority:3 ]
A2: Variable Set [ Name:%All_day_arr To:* Do Maths:Off Append:Off ]
Profile: Calendar Timed Events (776)
State: Calendar Entry [ Title:%Timed_cal Location:* Description:* Available:Any Calendar:Goo...@gmail.com ]
Enter: Anon (785)
A1: Notify [ Title:Timed Calendar Event Ran %TIME Text: Icon:null Number:0 Permanent:Off Priority:3 ]
> This is great! I assume that if I only want to track "busy" timed calendar events, I could change the parameter of availability to "busy" from "any" in your task? Not sure why I'm asking and not trying it, but in case others wonder, I have asked. ;-).
Not sure, I have never used that option.
>
> BTW, is there some reason for not naming Tasks?
No, I usually name all of my tasks, not sure why I did not name these. You can add names if you like..
I kept looking for them in the Tasks tab, but they weren't there
That is the reason. I usually name them.. :)
I noticed that they were all named "Anonymous" (which I assume means no name).
Correct..
Let me know how it works? I did as much testing as I could and it seems to be working as expected..
Rich..
> Let me know how it works? I did as much testing as I could and it seems to be working as expected..
>
Ahh... I forgot to include a reset option for when the device gets turned off, then back on. If the calendar events change during this time the contexts will need to be reset. It will need a 'monitor start' profile..
I will post a update, soon...
> I tried using "busy" rather than any and tested with different types of timed appts and it work fine.
Glad it worked. I do not use the calendar much. Could you explain what the 'busy' option is for and how is it used?
I look forward to the monitor reset profile. Thanks!
After more testing I do not think a reboot/monitor profile is necessary. Not sure why i thought it would be? After a reboot if a event has gone active or inactive the existing contexts will fire and reset the variables. It will Re-run any actions you have linked to the 'Calendar timed events' profile enter task even if no event changes have been made but depending on what you are doing that could be desirable. Let me know if you have any re-boot issues.
I did find one potential bug with the way i was doing the match to test if the Title was already in the 'ignore list'. So I changed that to a array search instead of searching just the variable and it has fixed that issue. I have attached the update.
As always, Rich, great work. I do want to know though, what's the test to determine if a calendar event is all day or not? Is it the 2nd profile?
--
> As always, Rich, great work. I do want to know though, what's the test to determine if a calendar event is all day or not?
The test is done in action A2 of the 'Calendar Main' profile.
A2 gets a comma separated list of yes or no. 'yes' is for all current all day events and 'no' is for Not a all day events.
A3 gets the list of all current active calendar titles.
Then the task compares the lists and gets the title of the active all day events and non all day events and puts them into variables.
So the all day event titles are added to the 'calendar main' profile context and the not all day events are added to the 'calendar Timed Events' profile context.
Profile: Calender Main (777)
State: Calendar Entry [ Title:%All_day_arr Location:* Description:* Available:Any Calendar:Google:ricp...@gmail.com ]
So, if I want to execute silent mode for non-all day events, should I check for %All_day_arr as context in new profile?
--
> So, if I want to execute silent mode for non-all day events, should I check for %All_day_arr as context in new profile?
No.
You would add a Action / silent mode to the enter task of the 'Calendar Timed Event' profile. That is all you would need to do.
I have made a final version and disabled all of the notifies and flashes and named the tasks. So if you import the attached you would add your Action / Silent mode the the 'Task' "Calendar Timed Enter"
Here are the descriptions and the XML for import.
Profile: Calender Main (803)
State: Calendar Entry [ Title:%All_day_arr Location:* Description:* Available:Any Calendar:* ]
Enter: Calendar Main Enter (798)
A1: Test App [ Type:Calendar All Day Data:%TIMES Store Result In:%cal_allday Continue Task After Error:On ]
A2: Test App [ Type:Calendar Title Data:%TIMES Store Result In:%cal_title Continue Task After Error:On ]
A3: Variable Set [ Name:%all_day_arr To:%All_day_arr Do Maths:Off Append:Off ]
A4: Variable Split [ Name:%all_day_arr Splitter:/ Delete Base:Off ]
A5: [X] Flash [ Text:%cal_allday(:) Long:Off ]
A6: Variable Set [ Name:%All_day_arr To:! Do Maths:Off Append:Off ] If [ %All_day_arr ~R \* ]
A7: For [ Variable:%index Items:1:%cal_title(#) ]
A8: Variable Set [ Name:%arr_match To:%cal_title(%index) Do Maths:Off Append:Off ]
A9: Variable Set [ Name:%match To:%all_day_arr(#?%arr_match) Do Maths:Off Append:Off ]
A10: If [ %match ~ 0 ]
A11: Variable Set [ Name:%All_day_arr To:/%cal_title(%index) Do Maths:Off Append:On ]
A12: Array Push [ Name:%all_day_arr Position:1 Value:%arr_match Fill Spaces:Off ]
A13: Variable Set [ Name:%Timed_cal To:/%cal_title(%index) Do Maths:Off Append:On ] If [ %cal_allday(%index) ~ no ]
A14: End If
A15: End For
A16: [X] Flash [ Text:%All_day_arr Long:Off ]
Profile: Calendar Timed Events (802)
State: Calendar Entry [ Title:%Timed_cal Location:* Description:* Available:Any Calendar:* ]
Enter: Calendar Timed Enter (800)
A1: [X] Notify [ Title:Timed Calendar Event Ran %TIME Text: Icon:null Number:0 Permanent:Off Priority:3 ]
Exit: Calendat Timed Exit (799)
A1: [X] Notify [ Title:Timed Events Stopped %TIME Text: Icon:null Number:0 Permanent:Off Priority:3 ]
A2: Variable Clear [ Name:%Timed_cal Pattern Matching:Off ]
A3: Variable Set [ Name:%All_day_arr To:* Do Maths:Off Append:Off ]
Profile: Calendar All Off (804)
State: Calendar Entry [ Title:* Location:* Description:* Available:Any Calendar:* ]
Enter: Calendar All Off Enter (797)
A1: [X] Notify [ Title:Active Events All On %TIME Text: Icon:null Number:0 Permanent:Off Priority:3 ]
Exit: Calendar All Off Exit (801)
A1: [X] Notify [ Title:No Active Events All Off %TIME Text: Icon:null Number:0 Permanent:Off Priority:3 ]
Fantastic. I'll give it a try.
--
I've been using your calendar code for months. I now have a nexus 6p and I'm having issues with the calendar timed code. It's no longer recognizing timed events. I just set up a test appt to see what would happen. It's not all day. Nevertheless, only calendar main and calendar appt. all off turn green in Tasker. I have Android 6.0.1 and Tasker 4.8. The code seemed to work earlier today for some appts but not all and I can't figure out a pattern. I set calendar timed to trigger if I set the busy option in the appt. I checked the Tasker log and calendar timed us not triggered. Thoughts? Suggestions? I use this a lot so I'd love for it to keep working. Thanks!
Suggestions?
Not sure.
I will get it going again and test on my device.
Suggestions? I use this a lot so I'd love for it to keep working. Thanks!
I am glad someone still uses this.. :)
This tested fine on my device. To trouble shoot. Start with
--no calendar events-
All profiles should be inactive.
%Timed_cal=
%All_day_arr= *
--Add a all day event named 'test all day'
Only calendar all off should be active
%Timed_cal=
%All_day_arr= !/test all day
-- add a timed event for the current time named 'test time'
Only
calendar all off should be active
Calendar timed should be active
%Timed_cal= /test time
%All_day_arr= !/test all day/test time
Let me know at what point this fails.
On my device changes to the calendar are picked up by tasker almost instantly.
You should be able to check
%Timed_cal=
%All_day_arr=
In the variables tab.
I have multiple settings like this. Vibrate for work,completely silent during a specific meeting or in a class. I had to do this because my schedule is completely random.
I can export my profiles if you like.
I have templates set up in my calendar app, so I can put the same calendar title in each time I have to work.
For meetings I make sure to write meeting in the calendar title, then have a profile that reacts to *meeting* pattern matching in the calendar title.
> Rich D, it's probably Tasker not working properly. I've seen several monitor restarts in my run log.
'Monitor restart' is normal. This usually means you have added or edited a context. 'Monitor start' usually means that tasker has been killed usually by android.
It's like Tasker is not checking the calendar often enough. I think the issue is related to the issue others are having with repeating events in marshmallow.
To confirm this I would suggest just making a new profile with a calendar entry context as a test profile.
Profile: Meeting Vibrate (8)
Restore: no
State: Calendar Entry [ Title:* Location:* Description:* Available:No Calendar:Google:*@gmail.com/Google:*@gmail.com
]
State: Not Profile Active [ Name:Office Vibrate ]
Enter: Meeting Vibrate (12)
A1: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
A2: [X] Profile Status [ Name:WiFi Switch Set:Off ]
A3: Do Not Disturb [ Mode:All ]
A4: Media Volume [ Level:0 Display:Off Sound:Off ]
A5: Alarm Volume [ Level:0 Display:Off Sound:Off ]
A6: Ringer Volume [ Level:0 Display:Off Sound:Off ]
A7: Notification Volume [ Level:0 Display:Off Sound:Off ]
A8: System Volume [ Level:0 Display:Off Sound:Off ]
A9: Silent Mode [ Mode:Vibrate ]
Exit: Meeting Unvibrate (13)
A1: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
A2: If [ %PACTIVE ~ *,Calendar Timed Events,* | %PACTIVE ~ *,Office Vibrate,* ]
A3: Goto [ Type:Action Label Number:1 Label:Meeting Unvibrate End ]
A4: Else
A5: Do Not Disturb [ Mode:All ]
A6: Silent Mode [ Mode:Off ]
A7: Alarm Volume [ Level:5 Display:Off Sound:Off ]
A8: Media Volume [ Level:10 Display:Off Sound:Off ]
A9: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A10: System Volume [ Level:5 Display:Off Sound:Off ]
A11: Notification Volume [ Level:5 Display:Off Sound:Off ]
A12: Ringer Volume [ Level:5 Display:Off Sound:Off ]
A13: [X] Profile Status [ Name:WiFi Switch Set:On ]
A14: Variable Clear [ Name:%INC_RA Pattern Matching:Off ]
<Meeting Unvibrate End>
A15: End If
in order to prevent task running for all day events , and assuming you dont care about events starting at midnight, why not using the %TIME var,