Code: Select all
def TheTask():
theWeather = eg.plugins.Suntracker.GetWeatherCondition()
#print theWeather
if eg.globals.IphoneNicoleOUT == "False" or eg.globals.IphoneHolgerOUT == "False":
bSunIsDown = eg.plugins.Suntracker.IsSunDown(-60, 60)
if not bSunIsDown and theWeather in (
"Fog",
"Haze",
"Light rain",
"Overcast",
"Fair",
"Heavy Rain",
"Rain",
"Rain Showers",
"Rain Shower",
"Ice/Snow",
"Freezing Rain",
"Freezing Drizzle",
"Light Drizzle",
"Drizzle",
"Flurries",
"Rain and Snow",
"Showers",
"Snow",
"Light snow",
"Snow Showers",
"Isolated Thunderstorms",
"Thunderstorm",
"Chance of Showers",
"Chance of Snow",
"Chance of Storm",
"Scattered Showers",
"Mist",
"Dust",
"Icy",
"Smoke",
"Sleet"
):
if not eg.globals.lights_ON:
eg.TriggerEvent('LICHT ON')
eg.globals.lights_ON = True
if not bSunIsDown and theWeather in (
"Cloudy",
"Mostly Cloudy",
"Partly Cloudy",
"Clear",
"Sunny",
"Mostly Sunny",
"Partly Sunny"
):
if eg.globals.lights_ON:
eg.TriggerEvent('LICHT OFF')
eg.globals.lights_ON = False
else:
print "niemand da"
if eg.globals.end == True:
eg.globals.end = False
print "Shutting down script..."
print "Script is stopped"
eg.StopMacro()
else:
remain = 600
print "Next execution will start in "+str(remain)+" seconds"
eg.scheduler.AddTask(remain, TheTask)
# Here we go...this is where the script starts
try:
dummy #Only used to initialise some variables at startup
except NameError:
dummy = 0
eg.globals.end = False
eg.globals.lights_ON = False
TheTask()