[Tasker Tips & Tricks] AKW:
Okay, so thanks to [MENTION=7050182]MishaalRahman[/MENTION], I've recently set up a profile that gives me the best route to work and the travel time in current traffic. I'm trying to modify it to take into account the time I'm supposed to be at work and the current travel time so that the task fires 5 minutes before I'm supposed to leave. For example, I'm supposed to be at work at 9:00am. If the travel time to work in current traffic is 24 minutes, I want the task to fire 29 minutes before I'm supposed to be at work and tell me that it's time to leave.

I figured the best way to do this is to have the task (minus the actual 'say' portion) fire after I dismiss my alarm in the morning and check the traffic every 3 minutes, until it detects that it's time to leave, at which point the 'say' action kicks in and tells me it's time to leave. The problem is that my 'If' condition that compares the variable containing the time I'm supposed to be at work (taking into account the travel time and the 5 minutes cushion) and the variable containing the current time never seems to be met, and I think it's probably in the conversions.

I'm almost positive the issue lies in my formulas, but I cannot seem to find it. I'm hoping one of you can help. Here's my task (I've also attached it if you want to try and tinker with it):

Task 1 - Get Traffic

1) Variable Clear; Name GMAPS; Label Top

2) Variable Set; Name %start; To (my home address)

3) Variable Set; Name %destination; To (my work address)

4) Variable Set; Name %api; To (my google maps api key)

5) HTTP Get that pulls traffic data from Google Maps

6) Variable Set; %GMAPS to %HTTPD

7) JavaScriptlet that parses the data down to the needed info

All of this works with no issue since it is basically pulled directly from the task that Mishaal posted. I'm almost positive the problem lies somewhere in the bold section below:

8) Variable Set; Name %Routename; To %routename (wanted to check what was populated on the 'vars' tab)

9) Variable Set; Name %Routetraffic; To %routetraffic (same reason as above)

10) Variable Split; %Routetraffic; Splitter m (so that all I have is '24' as opposed to '24 mins')

11) Variable Convert; Name %DATE; Function Date Time To Seconds; Store Result In %date

12) Variable Set; Name %Worktime (the time I'm supposed to be at work); To %date+(60*60*9); Do Maths Checked (9:00am)

13) Variable Set; Name %Timetoleave; To %Worktime-(%Routetraffic1*60)-300; Do Maths Checked (I multiplied %Routetraffic1 by 60 to convert to seconds and then subtracted 300 seconds to get that 5 minute cushion)

14) Variable Set; Name %time; To %TIMES (current time in seconds)

15) If; Condition %time = %Timetoleave OR %time > %Timetoleave (this way if the check happens after %time would have matched %Timetoleave, the task will still fire since %time will, theoretically, be a larger #)

16) Perform Task; Name Speak Traffic (This is the task that fires that tells me when to leave. Attached)

17) Stop

18) Else

19) Wait 3 minutes

20) Goto; Action Label Top

21) End if

I know it's a lot to look over, but any help would be greatly appreciated. This task could be incredibly useful if I can figure it out, and I would of course share it with the community. Thanks for all you do, guys.