Adding 17 mins to Time Variable

Posted on
Sat Aug 29, 2020 7:53 am
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Adding 17 mins to Time Variable

I have the sunrise time on a CP that I’m anal enough to want to correct for the sun’s rise over the mountain range that delays
it by 17 mins.

Maybe someway to do that with a script?

Thanks,

Carl

Posted on
Sun Aug 30, 2020 5:19 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Adding 17 mins to Time Variable

This should be pretty close. You'll need to create a variable to hold the new value and enter the ID of that variable in this script:

Code: Select all
import datetime as dt
adjusted_sunrise = indigo.server.calculateSunrise() + dt.timedelta(minutes=17)
result = dt.datetime.strftime(adjusted_sunrise, "%-I:%M")
indigo.variable.updateValue(VARIABLEIDHERE, value=result)

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sun Aug 30, 2020 11:56 am
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Adding 17 mins to Time Variable

Excellent, works great!

Many thanks,

Carl

Posted on
Sun Aug 30, 2020 1:23 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Adding 17 mins to Time Variable

Glad that worked for you.

Cheers.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 0 guests

cron