SunTracker - with moving ghost

Questions and comments specific to a particular plugin should go here.
Henrik4223
Posts: 47
Joined: Fri Mar 04, 2016 10:18 am

Re: SunTracker - with moving ghost

Post by Henrik4223 » Mon Mar 21, 2016 12:11 pm

GREAT!!! thanks a lot - that fixed it!

heggholmen
Posts: 6
Joined: Thu Aug 07, 2014 3:05 pm

Re: SunTracker - with moving ghost

Post by heggholmen » Tue Mar 22, 2016 6:08 pm

Thanks - good idea. I'll give it a try:)

dt1000
Posts: 18
Joined: Thu Apr 01, 2010 5:46 am

Re: SunTracker - with moving ghost

Post by dt1000 » Tue Apr 05, 2016 12:08 am

Hi there.
I have been using the GetWeatherCondition action to.... get the weather condition.
Recently it has stopped working, coming back with "undefined"as the result.
Has something changed?
Do I need to update the plugin?

Here is my error log...

20:03:41 SunTracker: GetWeatherCondition
20:03:41 Speech: Speak: The weather today will be {eg.result}
20:03:41 u'The weather today will be Undefined'
20:03:41 SunTracker: GetForecasts
20:03:41 Error in Action: "SunTracker: GetForecasts"
20:03:41 Traceback (most recent call last) (1669):
20:03:41 File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
20:03:41 return self(*args)
20:03:41 File "C:\Program Files (x86)\EventGhost\plugins\SunTracker\__init__.py", line 5318, in __call__
20:03:41 return self.plugin.weather_data['forecasts']
20:03:41 KeyError: 'forecasts'

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 » Tue Apr 05, 2016 5:28 am

Hard to say, I would guess something is currently not working with weather services at your location. I have sometimes noticed that the weather service temporarily may not work for some locations. Try to change your location settings to a more stable. For instance, instead of using a suburban type of setting, try a location closer to the center of the city.

Also, try this script and copy & paste the results here

Code: Select all

print eg.plugins.Suntracker.GetForecasts()
print eg.plugins.Suntracker.GetCurrentCondition()
#print eg.plugins.Suntracker.GetWeatherCondition()
#print eg.plugins.Suntracker.GetWindData()
#print eg.plugins.Suntracker.GetAtmosphereData()
#print eg.plugins.Suntracker.GetSunStateWithTimeStamp()
#print eg.plugins.Suntracker.GetSunState()
print eg.plugins.Suntracker.plugin.weather_data
My latest plugins
https://drive.google.com/drive/folders/ ... sp=sharing

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons

User1306
Posts: 47
Joined: Sat Oct 13, 2012 4:37 pm

Re: SunTracker - with moving ghost

Post by User1306 » Wed Apr 06, 2016 11:59 am

hi
I also have been having the same issue for the past couple of days, i didnt update or change anything, it just stopped working.
i tried to do what you mention above and updated my location, and i think it partly worked.
if i try eg.plugins.Suntracker.GetWeatherCondition i get "Undefined".
and if i try eg.plugins.Suntracker.GetForecasts i get this

Code: Select all

13:52:03      Error in Action: "SunTracker: GetForecasts"
13:52:03      Traceback (most recent call last) (1722):
13:52:03        File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
13:52:03          return self(*args)
13:52:03        File "C:\Program Files (x86)\EventGhost\plugins\SunTracker\__init__.py", line 5318, in __call__
13:52:03          return self.plugin.weather_data['forecasts']
13:52:03      TypeError: 'NoneType' object is unsubscriptable
any suggestions?

thanks

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 » Wed Apr 06, 2016 1:16 pm

If I run this script

Code: Select all

print eg.plugins.Suntracker.GetWeatherCondition()
print eg.plugins.Suntracker.GetForecasts()
I get the following results

Code: Select all

15:14:21   Light Rain
15:14:21   [{'day_of_week': u'Wednesday', 'high': u'7', 'sunset': u'7:44 PM', 'low': u'3', 'night': {'brief_text': u'Clear Late', 'text': u'Clouds Early / Clearing Late', 'chance_precip': u'20', 'humidity': u'84', 'wind': {'gust': u'N/A', 'direction': u'241', 'speed': u'30', 'text': u'WSW'}, 'icon': u'29'}, 'date': u'Apr 6', 'day': {'brief_text': u'Showers', 'text': u'Showers', 'chance_precip': u'60', 'humidity': u'84', 'wind': {'gust': u'N/A', 'direction': u'241', 'speed': u'30', 'text': u'WSW'}, 'icon': u'11'}, 'sunrise': u'5:59 AM'}, {'day_of_week': u'Thursday', 'high': u'10', 'sunset': u'7:44 PM', 'low': u'3', 'night': {'brief_text': u'Cloudy', 'text': u'Cloudy', 'chance_precip': u'20', 'humidity': u'80', 'wind': {'gust': u'N/A', 'direction': u'191', 'speed': u'22', 'text': u'S'}, 'icon': u'26'}, 'date': u'Apr 7', 'day': {'brief_text': u'Light Rain', 'text': u'Light Rain', 'chance_precip': u'70', 'humidity': u'75', 'wind': {'gust': u'N/A', 'direction': u'191', 'speed': u'22', 'text': u'S'}, 'icon': u'11'}, 'sunrise': u'5:59 AM'}, {'day_of_week': u'Friday', 'high': u'10', 'sunset': u'7:44 PM', 'low': u'2', 'night': {'brief_text': u'P Cloudy', 'text': u'Partly Cloudy', 'chance_precip': u'10', 'humidity': u'79', 'wind': {'gust': u'N/A', 'direction': u'224', 'speed': u'19', 'text': u'SW'}, 'icon': u'29'}, 'date': u'Apr 8', 'day': {'brief_text': u'Cloudy', 'text': u'Cloudy', 'chance_precip': u'20', 'humidity': u'67', 'wind': {'gust': u'N/A', 'direction': u'224', 'speed': u'19', 'text': u'SW'}, 'icon': u'26'}, 'sunrise': u'5:59 AM'}, {'day_of_week': u'Saturday', 'high': u'12', 'sunset': u'7:44 PM', 'low': u'0', 'night': {'brief_text': u'P Cloudy', 'text': u'Partly Cloudy', 'chance_precip': u'0', 'humidity': u'78', 'wind': {'gust': u'N/A', 'direction': u'247', 'speed': u'14', 'text': u'WSW'}, 'icon': u'29'}, 'date': u'Apr 9', 'day': {'brief_text': u'P Cloudy', 'text': u'Partly Cloudy', 'chance_precip': u'10', 'humidity': u'58', 'wind': {'gust': u'N/A', 'direction': u'247', 'speed': u'14', 'text': u'WSW'}, 'icon': u'30'}, 'sunrise': u'5:59 AM'}, {'day_of_week': u'Sunday', 'high': u'12', 'sunset': u'7:44 PM', 'low': u'0', 'night': {'brief_text': u'M Clear', 'text': u'Mostly Clear', 'chance_precip': u'0', 'humidity': u'75', 'wind': {'gust': u'N/A', 'direction': u'72', 'speed': u'9', 'text': u'ENE'}, 'icon': u'33'}, 'date': u'Apr 10', 'day': {'brief_text': u'M Sunny', 'text': u'Mostly Sunny', 'chance_precip': u'0', 'humidity': u'61', 'wind': {'gust': u'N/A', 'direction': u'72', 'speed': u'9', 'text': u'ENE'}, 'icon': u'34'}, 'sunrise': u'5:59 AM'}]

Just to verify, try another location like GMXX0007:1:GM
My latest plugins
https://drive.google.com/drive/folders/ ... sp=sharing

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons

dt1000
Posts: 18
Joined: Thu Apr 01, 2010 5:46 am

Re: SunTracker - with moving ghost

Post by dt1000 » Wed Apr 06, 2016 5:33 pm

Hello!

I did a clean install of Event Ghost, set-up Suntracker with the default location info, made a macro to run the script you suggested, and this is what I got in the log :
  • Python Script
    Undefined
    Traceback (most recent call last):
    Python script "1", line 2, in <module>
    print eg.plugins.Suntracker.GetForecasts()
    File "C:\Program Files (x86)\EventGhost\plugins\SunTracker\__init__.py", line 5318, in __call__
    return self.plugin.weather_data['forecasts']
    KeyError: 'forecasts'
I also tried the co-ordinates for New York...
  • Longitude: 40.7128
    Latitude: -74.0059
    Location: 2459115
...and got the same thing.

Is there an update to Sun Tracker that we need to download? What geographic info are you using?

And thanks for your help - we appreciate it! :D

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 » Thu Apr 07, 2016 4:03 am

@dt1000

I suspect you are using the Suntracker version included in the Eventghost setup. Unfortunately, this is not the latest, it might even be obsolete. You have to upgrade the plugin, see the link below for download. For New York you can use USNY0996:1:US
My latest plugins
https://drive.google.com/drive/folders/ ... sp=sharing

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons

dt1000
Posts: 18
Joined: Thu Apr 01, 2010 5:46 am

Re: SunTracker - with moving ghost

Post by dt1000 » Thu Apr 07, 2016 4:48 pm

Thanks for the tip.
I updated the plugin and get a very similar error...
  • Python Script
    Undefined
    Traceback (most recent call last):
    Python script "0", line 2, in <module>
    print eg.plugins.Suntracker.GetForecasts()
    File "C:\Program Files (x86)\EventGhost\plugins\SunTracker\__init__.py", line 5431, in __call__
    return self.plugin.weather_data['forecasts']
    KeyError: 'forecasts'
Is there something special I need to do to update the plugin properly?

dt1000
Posts: 18
Joined: Thu Apr 01, 2010 5:46 am

Re: SunTracker - with moving ghost

Post by dt1000 » Thu Apr 07, 2016 4:51 pm

Ah! Changing the location info as you suggested seemed to fix it.
The code I was using was from Yahoo Weather, not The Weather Channel.
Maybe Yahoo have altered something recently that breaks Sun Tracker?
I'll stick with TWC for now. Thanks for the help!
:D

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 » Thu Apr 07, 2016 5:09 pm

Yep, Yahoo is not working any longer, it was quit a while it stopped actually. Now it is Weather.com that I use and it seems to have been reasonable stable for some while
My latest plugins
https://drive.google.com/drive/folders/ ... sp=sharing

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons

thedude
Posts: 13
Joined: Sun Apr 17, 2016 6:41 am

Re: SunTracker - with moving ghost

Post by thedude » Mon Apr 18, 2016 9:57 am

Thanks for this neat plugin. I have the basic configs for sunrise/sunset down by reading posts here. But there is another idea I have that I don't know how to execute and would kindly ask for assistance.

I'd like to trigger an event ( eg.TriggerEvent('') when chance of precipitation falls in different ranges for the next day. I see the parameters 'chance_precip' when I use the eg.plugins.Suntracker.GetForecasts(), but I have no idea how to parse it as my python is very weak. Also I have no idea how to get get weather forecast for the next day so it checks it repeatedly everyday on schedule or loops as I don't see it in the plugin config.

So the general idea would once eg.plugins.Suntracker.GetForecasts() runs, it grabs the data for the next day specifically so forecasts[1] .

If 'chance_precip' is between 0-10 it would trigger event "main.noraintmrw", if between 20-30 it will trigger event "main.dizzletmrw" and so on.

Can anyone give me an idea how to do this? Thanks in any event.

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 » Mon Apr 18, 2016 12:30 pm

Thanks!

You try with this python script that selects example of the data you are looking for

Code: Select all

fc = eg.plugins.Suntracker.GetForecasts()

nc_p = fc[1]['night']['chance_precip']
nf = fc[1]['night']['text']
dc_p = fc[1]['day']['chance_precip']
df = fc[1]['day']['text']

print 'Forecast tomorrow night: ', nf
print 'Forecast tomorrow day: ', df

if nc_p <= 10:
        eg.TriggerEvent(
            'No rain tomorrow night',
            payload = '',
            prefix = 'WeatherForecast'
        )
if nc_p > 10 and nc_p <= 20:
        eg.TriggerEvent(
            'Drizzle tomorrow night',
            payload = '',
            prefix = 'WeatherForecast'
        )
if nc_p > 20 and nc_p <= 30:
        eg.TriggerEvent(
            '??? tomorrow night',
            payload = '',
            prefix = 'WeatherForecast'
        )

if dc_p <= 10:
        eg.TriggerEvent(
            'No rain tomorrow day',
            payload = '',
            prefix = 'WeatherForecast'
        )
if dc_p > 10 and nc_p <= 20:
        eg.TriggerEvent(
            'Drizzle tomorrow day',
            payload = '',
            prefix = 'WeatherForecast'
        )
if dc_p > 20 and nc_p <= 30:
        eg.TriggerEvent(
            '??? tomorrow day',
            payload = '',
            prefix = 'WeatherForecast'
        )

# etc, etc, etc, just add more rules for night & day
My latest plugins
https://drive.google.com/drive/folders/ ... sp=sharing

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons

thedude
Posts: 13
Joined: Sun Apr 17, 2016 6:41 am

Re: SunTracker - with moving ghost

Post by thedude » Mon Apr 18, 2016 7:40 pm

krambriw wrote:message
Oh wow, thanks for the reply!

1) I need to backup and ask a question on simple sunrise/sunset. This morning I woke up to a barrage of notifications from Sunrise event as it was triggered like 10 times after correct sunrise :lol: . I read some more and apparently synchronization feature causes this, so I disabled it. If I want one simple event triggered at sunrise/sunset, is this config correct?
Image
Image
Image

2) About chance of precipitation script, it's not triggering event at all when I test it even though 'chance_precip' is currently 0. It should generate event like "WeatherForecast.No rain tomorrow day" and "WeatherForecast.No rain tomorrow night", correct? All it shows is this in log:
Image

3)Where should I put this script in EG so it runs every day? This is my n00b guess:
Image

4)Can you explain what is the concept behind "moving ghost"? I searched the thread, I can't any meaningful explanation.

Thanks in advance

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 » Tue Apr 19, 2016 5:31 am

1) Almost. You do not need to have the action (SunTracker: "SunTracker") for sunrise/sunset events, those are created by the plugin itself. To make actions to generate events, you need to fill in at least one time for each daytype. If you only need events at sunset/sunrise, fill in 1100 for all 'Morning ON' settings

2) Ooops, try this script instead

Code: Select all

fc = eg.plugins.Suntracker.GetForecasts()

nc_p = int(fc[1]['night']['chance_precip'])
nf = fc[1]['night']['text']
dc_p = int(fc[1]['day']['chance_precip'])
df = fc[1]['day']['text']

print 'Forecast tomorrow night: ', nf
print 'Forecast tomorrow day: ', df

if nc_p <= 10:
        eg.TriggerEvent(
            'No rain tomorrow night',
            payload = '',
            prefix = 'WeatherForecast'
        )
if nc_p > 10 and nc_p <= 20:
        eg.TriggerEvent(
            'Drizzle tomorrow night',
            payload = '',
            prefix = 'WeatherForecast'
        )
if nc_p > 20 and nc_p <= 30:
        eg.TriggerEvent(
            '??? tomorrow night',
            payload = '',
            prefix = 'WeatherForecast'
        )

if dc_p <= 10:
        eg.TriggerEvent(
            'No rain tomorrow day',
            payload = '',
            prefix = 'WeatherForecast'
        )
if dc_p > 10 and nc_p <= 20:
        eg.TriggerEvent(
            'Drizzle tomorrow day',
            payload = '',
            prefix = 'WeatherForecast'
        )
if dc_p > 20 and nc_p <= 30:
        eg.TriggerEvent(
            '??? tomorrow day',
            payload = '',
            prefix = 'WeatherForecast'
        )

# etc, etc, etc, just add more rules for night & day
3) To run anything a certain day or time, you need a scheduler plugin. Two examples are SchedulGhost and Scheduler. You can read about and find them here:
http://eventghost.net/forum/viewtopic.php?f=9&t=2740
http://eventghost.net/forum/viewtopic.p ... uler#p5067
(If you go for the Scheduler, instead of using the version in the post, download using my link below to be sure you get the latest)

You then simply put the script and the scheduler event in a macro. The script will be executed when the event triggers the macro.

4) The Moving Ghost is a special mode of operation for a SunTracker action. When activated, it will randomly generate On/Off events that can be used to control lamps etc in your home. The idea is to give strangers observing your home the impression that you are at home (even if you happen to be away). The time span between events are a bit longer BEFORE midnight and shorter AFTER midnight.

BR Walter
My latest plugins
https://drive.google.com/drive/folders/ ... sp=sharing

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons

Post Reply