def __init__(self, data, sleepEvent):

        self.data = data
        self.sleepEvent = sleepEvent
        self.weather_frequency = data.config.weather_update_freq
        self.time_format = data.config.time_format
        self.icons = get_icons("ecIcons_utf8.csv")
        self.network_issues = data.network_issues
Beispiel #2
0
    def __init__(self, data, sleepEvent):

        self.data = data
        self.sleepEvent = sleepEvent
        self.weather_frequency = data.config.weather_update_freq
        self.time_format = data.config.time_format
        self.icons = get_icons("ecIcons_utf8.csv")
        self.apikey = data.config.weather_owm_apikey
        self.network_issues = False
        self.owm = OWM(self.apikey)
        self.owm_manager = self.owm.weather_manager()
Beispiel #3
0
    def __init__(self, data, scheduler):

        self.data = data
        self.weather_frequency = data.config.weather_update_freq
        self.time_format = data.config.time_format
        self.icons = get_icons("ecIcons_utf8.csv")
        self.network_issues = data.network_issues

        scheduler.add_job(self.getWeather,
                          'interval',
                          minutes=self.weather_frequency,
                          jitter=60,
                          id='ecWeather')
        #Check every 5 mins for testing only
        #scheduler.add_job(self.CheckForUpdate, 'cron', minute='*/5')

        #Get initial obs
        self.getWeather()
    def __init__(self, data, scheduler):

        self.data = data
        self.scheduler = scheduler
        self.weather_frequency = data.config.weather_update_freq
        self.time_format = data.config.time_format
        self.icons = get_icons("ecIcons_utf8.csv")
        self.network_issues = data.network_issues
        self.currdate = datetime.now()

        self.apikey = data.config.weather_owm_apikey

        self.max_days = data.config.weather_forecast_days


        if self.data.config.weather_data_feed.lower() == "owm":

            self.owm = OWM(self.apikey)
            self.owm_manager = self.owm.weather_manager()


        # Get forecast for next day, every forecast_update hours

        hour_update = '*/' + str(self.data.config.weather_forecast_update)

        scheduler.add_job(self.getForecast, 'cron', hour=hour_update,minute=0,id='forecast')
        #Check every 5 mins for testing only
        #scheduler.add_job(self.GetForecast, 'cron', minute='*/5')

        nextrun = scheduler.get_job('forecast').next_run_time
        debug.info("Updating weather forecast every {} hour(s) starting @ {}".format((self.data.config.weather_forecast_update),nextrun.strftime("%H:%M")))
        #debug.info(scheduler.print_jobs())

        #Set up units [temp, wind speed,precip, storm distance]
        #Use these eventhough some are included in data feed
        if self.data.config.weather_units == "metric":
            self.data.wx_units = ["C","kph","mm","miles","hPa","ca"]
        else:
            self.data.wx_units = ["F","mph","in","miles","MB","us"]

        #Get initial forecast
        self.getForecast()