Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

SunTracker - with moving ghost

Questions and comments specific to a particular plugin should go here.
holle75
Posts: 33
Joined: Thu Apr 19, 2012 5:47 pm

Re: SunTracker - with moving ghost

Post by holle75 »

... i┬┤m just asking because of the nice, special script you wrote me :

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()
if the status messages change, i have to change also the script.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: SunTracker - with moving ghost

Post by krambriw »

Yes, I think it may happen.
I believe I am logging if the condition is not found in the list. The trick is to find out all possible conditions that they might use (and the correct spelling). I think for instance the 'Light rain' is used by Google but ' Light Rain' by Yahoo.

BestR Walter
holle75
Posts: 33
Joined: Thu Apr 19, 2012 5:47 pm

Re: SunTracker - with moving ghost

Post by holle75 »

... is there a trick i can print the error in the log in red if a status is not matching any of the statuses in the Walter-Weather-Script?
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: SunTracker - with moving ghost

Post by krambriw »

...not from the script itself but I have made this handled by the plugin. Check the first post.

BestR Walter
holle75
Posts: 33
Joined: Thu Apr 19, 2012 5:47 pm

Re: SunTracker - with moving ghost

Post by holle75 »

... so smart!
holle75
Posts: 33
Joined: Thu Apr 19, 2012 5:47 pm

Re: SunTracker - with moving ghost

Post by holle75 »

Hello Walter, i got two errors with the newest version (29.08.12) during the day and the SunTracker seems to has stopped in a way (no switching lights at sunset)

the first :

Code: Select all

19:11:02   Walter - Kein Licht ON weil niemand da
19:11:02   Next execution will start in 600 seconds
19:19:01   Yahoo!Weather condition not in list: Unknown
19:19:01   Exception in thread suntracker ANWESEND:
19:19:01   Traceback (most recent call last):
19:19:01     File "threading.pyc", line 532, in __bootstrap_inner
19:19:01     File "C:\Programme\EventGhost\plugins\SunTracker\__init__.py", line 1128, in run
19:19:01       self.iOffset
19:19:01   TypeError: 'bool' object is not iterable
19:19:01   
19:21:02   Unknown
19:21:02   Walter - Kein Licht ON weil niemand da
the second:

Code: Select all

21:31:35            Moving Ghost function OFF
21:31:35            GHOST ist OFF
21:31:35            Yahoo!Weather condition not in list: Light Rain Shower
21:31:35            Traceback (most recent call last):
21:31:35              Python script "10", line 4, in <module>
21:31:35                bSunIsDown = eg.plugins.Suntracker.IsSunDown(-60, 30)
21:31:35              File "C:\Programme\EventGhost\plugins\SunTracker\__init__.py", line 4302, in __call__
21:31:35                self.iTimeAhead
21:31:35            TypeError: 'bool' object is not iterable
21:31:35   Application.Launched.winamp
21:31:35      Spotify UpdateData holger
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: SunTracker - with moving ghost

Post by krambriw »

Ahhhhh, I created a bug in the weather calculation function, sorry

Fixed a new version and uploaded it. Also added the new weather conditions that made my bug visible. You can open the weather_conditions.py file and look inside how the different weather conditions are inserted and categorized.

Hopefully this will now work....

Best regards, Walter
holle75
Posts: 33
Joined: Thu Apr 19, 2012 5:47 pm

Re: SunTracker - with moving ghost

Post by holle75 »

i┬┤m going to check. this extra list with the weather conditions is very helpful. thank you for that.
cheater
Posts: 11
Joined: Mon Nov 24, 2008 8:54 am

Re: SunTracker - with moving ghost

Post by cheater »

Hi,
I am from Germany, but I'll try my best to write good english :wink: .

I just discovered SunTracker, but its very complicated for me.

I want to start an event at sunrise an start anotherone at sunset. Can someone please explain me how to arrange the right settins? Pictures would be very useful.

Thank you very much!
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: SunTracker - with moving ghost

Post by krambriw »

Deutsch ist auch ok wenn es leichter wird. Ich wird doch auf English antworten. Probier mal etwas wie es unten geseigt ist.
Gruss, Walter
Image2.jpg
cheater
Posts: 11
Joined: Mon Nov 24, 2008 8:54 am

Re: SunTracker - with moving ghost

Post by cheater »

Hallo, was passiert um 11:59 Uhr?

Ich habe es so eingestellt und die Systemuhr umgestellt auf 11:58Uhr, aber es passiert nichts.

Thank you very much. :wink:
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: SunTracker - with moving ghost

Post by krambriw »

Nothing really happens at 11:59,
any time setting is needed for the logic to start (could maybe be improved in a future version but this is how it is).

At 11:59 (at noon) the sun is up at its highest peak so nothing will be triggered. You will get a trigger at sunset and at sunrise and a sync every 30 min in between if you follow the settings in the picture.

Best regards, Walter
cheater
Posts: 11
Joined: Mon Nov 24, 2008 8:54 am

Re: SunTracker - with moving ghost

Post by cheater »

Habe alles genauso eingestellt, aber leider bekomme ich kein Sunrise Event!
Attachments
Screenshot.png
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: SunTracker - with moving ghost

Post by krambriw »

Maybe a misunderstanding.

With those settings you will get an event at sunset and at sunrise. The name of the events will be what you have written in "Eventname ON" that will be triggered at sunset and "Eventname OFF" that will be triggered at sunrise.

In your picture you got an event with name "Zeitraffer deaktiviert" at 06.35, at sunrise. This is correct. If Zeitraffer would be a lamp, you would use this event to turn it off.

It is working correctly but maybe you are looking for something else. Please specify better then what you want to achieve.
If you just would like to have an event with the names "Sunrise" and "Sunset" you just put that in as names for "Eventname OFF" and "Eventname ON" respectively.

Best regards, Walter
Noelba
Posts: 1
Joined: Tue Sep 04, 2012 6:04 pm

Re: SunTracker - with moving ghost

Post by Noelba »

Bug?
I run the latest version and fight the following problem. The events Main.sunset and Main.Sunrise appear 2 hours too early, while the announced times in the log are completely correct.

Regards Noelba
Post Reply