Time context w/ variable?

975 views
Skip to first unread message

derobert

unread,
Aug 16, 2011, 9:24:59 AM8/16/11
to Tasker
I'm trying to enable auto-brightness (and eventually maybe some other
stuff) during daytime only.

I found http://tasker.wikidot.com/sunrise-and-sunset-times which gets
me sunrise and sunset in variables, and currently I've got a profile
with time 0800–2000 to turn auto-brightness on.

I'd like to use the variables instead of the hard-coded times, but it
seems that I can't use a variable there. Is there a way to do this, or
do I need to wait for "actions to modify profiles real-time, e.g. time
context start time" from the plan file?

Pent

unread,
Aug 16, 2011, 10:07:18 AM8/16/11
to Tasker
> I'd like to use the variables instead of the hard-coded times, but it
> seems that I can't use a variable there. Is there a way to do this, or
> do I need to wait for "actions to modify profiles real-time, e.g. time
> context start time" from the plan file?

Well, you could try the usual Insert Calendar Entry workaround and
trigger off the Calendar Entry state, it needs a little calculation is
all.

Pent

BossMan

unread,
Aug 16, 2011, 11:03:55 AM8/16/11
to tas...@googlegroups.com
BTW (regarding the wiki recipe) I am not sure, but I think the trick with a separate location-based profile that is toggled enabled/disabled in order to get the position is not needed anymore as there is a new "Get Location" action available.

BR,
A.

Anthony DeRobertis

unread,
Aug 16, 2011, 11:09:34 AM8/16/11
to tas...@googlegroups.com
I confess I don't know what the usual Insert Calendar Entry workaround is, but I can take a guess. Is there some way to do it without all the normal "side-effects" of a calendar entry (notification, showing up in calendar widgets, etc.)?

BossMan

unread,
Aug 16, 2011, 11:20:43 AM8/16/11
to tas...@googlegroups.com
Sure. Create another calendar in your google account that will be used by Tasker only and configure widgets/calendars not to display that calendar :-)

BR,
A.

Anthony DeRobertis

unread,
Aug 16, 2011, 11:30:44 AM8/16/11
to tas...@googlegroups.com
On Tue, Aug 16, 2011 at 11:03, BossMan <adam.ma...@gmail.com> wrote:
BTW (regarding the wiki recipe) I am not sure, but I think the trick with a separate location-based profile that is toggled enabled/disabled in order to get the position is not needed anymore as there is a new "Get Location" action available.

Yeah, it isn't required, I should update that wiki entry. I entered it using Get Location, and that worked for me (in fact, that's whats in the export I uploaded).

Anthony DeRobertis

unread,
Aug 17, 2011, 3:11:19 PM8/17/11
to tas...@googlegroups.com
FYI, I've used the calendar entry workaround, which basically works though occasionally suffers from an off-by-one-minute error, that I'm just ignoring. Scheduling it at 4AM probably even makes it work in the face of daylight saving time.

I've uploaded both to the wiki:
http://tasker.wikidot.com/local--files/sunrise-and-sunset-times/Sunrise%20and%20Sunset%2C%20v2
http://tasker.wikidot.com/local--files/sunrise-and-sunset-times/Daytime%20to%20Calendar

Hope these help someone.

t4r

unread,
Oct 11, 2011, 4:33:45 PM10/11/11
to Tasker
When I try test "sun data" profile, there is a message: code 3:
java.lang.arrayindexoutofboundsexception.
I tried on Tasker v. 1.1.1u2 and 1.1.1.b8
what can I do?

Pent

unread,
Oct 12, 2011, 4:07:11 AM10/12/11
to Tasker
I couldn't find a 'sun data' profile in the links, could you export
the profile description here ? Click on profile, options button,
export, description to clipboard.

Also, a log would be great :-)

http://tasker.dinglisch.net/faq-how.html#x

Thanks,

Pent

t4r

unread,
Oct 13, 2011, 3:27:17 PM10/13/11
to Tasker
I download the profile from here: http://tasker.wikidot.com/sunrise-and-sunset-times

log: http://dl.dropbox.com/u/20231158/log.txt

description:
Profile: Sunshine - Check (55)
Time: From 00:00 Till 00:01
Enter: Sun Data (52)
A1: Get Location [Source:Net Timeout (Seconds):30 Continue Task
Immediately:Off]
A2: Variable Split [Name:%LOC Splitter:, Delete Base:Off]
A3: Variable Split [Name:%DATE Splitter:- Delete Base:Off]
A4: HTTP Get [Server:Port:www.earthtools.org Path:/sun/
%LOC1/%LOC2/%DAYM/%DATE1/-5/1 Attributes: Timeout:12 Mime Type:text/
xml Output File:]
A5: Variable Set [Name:%HTTPD0 To:%HTTPD Do Maths:Off Append:Off]
A6: Variable Split [Name:%HTTPD0 Splitter:</sunrise> Delete Base:Off]
A7: Variable Split [Name:%HTTPD01 Splitter:<sunrise> Delete Base:Off]
A8: Variable Set [Name:%Sunrise To:%DATE %HTTPD012 Do Maths:Off
Append:Off]
A9: Variable Split [Name:%HTTPD0 Splitter:</sunset> Delete Base:Off]
A10: Variable Split [Name:%HTTPD01 Splitter:<sunset> Delete Base:Off]
A11: Variable Set [Name:%Sunset To:%DATE %HTTPD012 Do Maths:Off
Append:Off]
A12: Variable Clear [Name:%HTTPD+ Pattern Matching:On]
A13: Variable Clear [Name:%LOC1 Pattern Matching:Off]
A14: Variable Clear [Name:%LOC2 Pattern Matching:Off]
A15: Variable Clear [Name:%DATE+ Pattern Matching:On]
A16: Variable Convert [Name:%Sunrise Function:Date Time to Seconds
Store Result In:%SunriseMin]
A17: Variable Convert [Name:%Sunset Function:Date Time to Seconds
Store Result In:%SunsetMin]
A18: Flash [Text:Sunshine Data retrieved for %LOC
%Sunrise - %Sunset Long:On]
Exit: Sun Calendar (53)
A1: Variable Set [Name:%DAYSTART To:%SunriseMin / 60 - %TIMES / 60 Do
Maths:On Append:Off]
A2: Variable Set [Name:%DAYLENGTH To:%SunsetMin / 60 - %SunriseMin /
60 Do Maths:On Append:Off]
A3: Variable Set [Name:%DAYSTART To:%DAYSTART + 1440 Do Maths:On
Append:Off] Variable Set [ %DAYSTART < 0 ]
A4: Variable Split [Name:%DAYSTART Splitter:. Delete Base:Off]
A5: Variable Split [Name:%DAYLENGTH Splitter:. Delete Base:Off]
A6: Calendar Insert [In / For (Minutes):%DAYSTART1 / %DAYLENGTH1
Calendar:Google:Tasker Title:Daytime Description: Location:
Available:Off]
A7: Variable Clear [Name:%DAY* Pattern Matching:On]
A8: Variable Clear [Name:%SunriseMin Pattern Matching:Off]
A9: Variable Clear [Name:%SunsetMin Pattern Matching:Off]
A10: Flash [Text:Sunshine Data saved to Calender Long:On]

Pent

unread,
Oct 13, 2011, 3:43:01 PM10/13/11
to Tasker
Thanks, that had a good error description in. Could you tell me which
Tasker version you are running though ?

In Tasker, Menu / Info / About, it should be something like e.g.
'1.1.1u2m'

Thanks,

Pent

t4r

unread,
Oct 13, 2011, 4:29:03 PM10/13/11
to Tasker
I tried this on Tasker v. 1.1.1u2 and 1.1.1.b8 in both version I get
the same error

Paul Jaekel

unread,
Nov 7, 2011, 12:44:05 AM11/7/11
to Tasker
With daylight savings time just ending this past Sunday I am getting
the sunrise and sunset time still an hour later as if daylight savings
time was still running. Is there anyway to have Tasker create the
calendar with times starting and ending a hour earlier now that
daylight saving time ended?

I'm talking about the profile that is downloadable from
http://tasker.wikidot.com/sunrise-and-sunset-times

Paul Jaekel

unread,
Nov 8, 2011, 1:56:55 AM11/8/11
to Tasker
Ok, after spending another night on messing around with the profile I
figured it out. I edited the task "HTTP GET" for earthtools.org and
changed the "1" at the end of the url in the "path" area to a "0" to
turn off DSL. So now it seems to be putting in the correct times in
the calendar. I just wanted to shear this in case someone else has the
same problem and is looking for answers.

On Nov 7, 12:44 am, Paul Jaekel <viper...@gmail.com> wrote:
> With daylight savings time just ending this past Sunday I am getting
> the sunrise and sunset time still an hour later as if daylight savings
> time was still running. Is there anyway to have Tasker create the
> calendar with times starting and ending a hour earlier now that
> daylight saving time ended?
>
> I'm talking about the profile that is downloadable fromhttp://tasker.wikidot.com/sunrise-and-sunset-times

pearlm...@gmail.com

unread,
Dec 19, 2011, 9:14:07 AM12/19/11
to tas...@googlegroups.com
Has anyone figured out the error?  I am loving Tasker.  I cannot get either Wiki Profile for downloading Sunrise/Sunset times to work.  I have tried them both on my HTC Incredible2 and my Motorola Xoom.  Both produce the same error.

pearlm...@gmail.com

unread,
Dec 19, 2011, 10:02:03 AM12/19/11
to tas...@googlegroups.com
Update:

I figured out the error.  The %LOC and %LOC1/%LOC2 needs to be %LOCN, %LOCN1/%LOCN2.  Now I just need to figure out how to get the time for my timezone.  Changing the /1 to /0 at the end of the url string gets me an hour closer, but it is still an hour off.

pearlm...@gmail.com

unread,
Dec 19, 2011, 10:53:04 AM12/19/11
to tas...@googlegroups.com
OK.  I got it.  For anyone interested, the where.yahooapis.com tasks worked better for me as the other did not capture the accurate time/timezone.  You still need to change the %LOC to %LOCN and the %LOC1 and %LOC2 to %LOCN1 and %LOCN2.

Mobilla

unread,
Feb 14, 2012, 7:01:13 PM2/14/12
to Tasker
I found an easier way; just change the HTTP request
from:
/sun/%LOC1/%LOC2/%DAYM/%DATE1/-5/1
to:
/sun/%LOC1/%LOC2/%DAYM/%DATE1/99/1

The -5 is the author's time zone, replacing it with 99 will make it
use the current time zone for that location (according to the
earthtools website).

Anony Mouse

unread,
Jun 18, 2012, 12:18:58 PM6/18/12
to tas...@googlegroups.com
I have tried and tried and tried to work with these profiles numerous times and I have not been able to do much with it. Previously, I was able to get the calendar to show the sunrise/sunset times somehow after spending some time working on it. I was never able to get the brightness profile to work. It would lower the brightness all day, no matter what time it was. I backed up the profile and tasks (that were working at the time) and ended up having to do a factory restore of the phone yesterday. Now, I can't even get the calendar profile to work. The times aren't appearing on the calendar anymore after restoring the once working profile. Now, I keep getting an error message about variable convert of the %sunshine %sunset failing. It says the data for my location was received, then a message pops up that the data is saved to the calendar, but when I sync the calendar, the times for "Daylight" are no longer listing.

I am about to pull my hair out trying to get this to work... if only just to show the times on the calendar. I would love to be able to get the brightness level to work with my car dock app to lower the brightness of the screen at night, but even getting the information to be able to manually apply is better than nothing.

I am using the profiles from here (the xlm files):

 http://tasker.wikidot.com/sunrise-and-sunset-times

I have done as suggested and changed the %LOC to %LOCN, %LOC1 to %LOCN1, %LOC2 to %LOCN2, and changed the 1/-5/1 to 1/99/1.

Does anyone have a working profile that they wouldn't mind sharing with me so that I will at least be able to see the times on my calendar? Thank you very much.

Oscar C

unread,
Dec 29, 2012, 1:18:47 PM12/29/12
to tas...@googlegroups.com
after reading and trying and failing i went to website and find out that if you use 1 at the end it means dts is on if you use 0 is off. that makes the trick 
dst - whether daylight saving time should be taken into account (either 0 for no or 1 for yes).

Irimi-Ai

unread,
Jul 31, 2015, 10:26:56 AM7/31/15
to Tasker, oscark...@gmail.com
Seems like a recent Tasker update broke this for me.  Anyone else getting errors on the "%Sunrise To:%DATE %HTTPD012" Action?

Rich D

unread,
Jul 31, 2015, 6:41:41 PM7/31/15
to Tasker Google Groups Post


> Seems like a recent Tasker update broke this for me.  Anyone else getting errors on the "%Sunrise To:%DATE %HTTPD012" Action?

What are the errors?

Could you post the task description?

What does the run log show? Menu / more /  run log

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).

Reply all
Reply to author
Forward
0 new messages