Hello,
Is there a way to get the Current Time, Sunrise and Sunset information shown in the Indigo Client (lower right corner) to display in a Control Page?
If there is a way I have not been able to find it or figure it out.
Thanks.
from datetime import datetime
now = datetime.now()
day = f"{now:%A}"
fancy_date = f"{now:%B %d, %Y}"
fancy_time = f"{now:%I:%M}"
am_pm = f"{now:%p}"
indigo.variable.updateValue(12345676, day)
indigo.variable.updateValue(12345677, fancy_date)
indigo.variable.updateValue(12345678, fancy_time)
indigo.variable.updateValue(12345679, am_pm)
my_var = indigo.variables[12345678] # this is how you reference an Indigo Variable -- by its ID (or its name, although that's discouraged).
my_test = my_var.value # Get the value of my_var (Indigo variables always contain a text string). Let's say here it's "20".
my_test = int(my_test) # Convert the text string to an integer.
if my_test > 10: # Since 20 > 10, this "if" will be executed
return True # Return the value True
else:
return False # You don't have to do this, but it's nice to be thorough.
Users browsing this forum: No registered users and 0 guests