From 181b86e3612af283c64f338fd4e5e12e396c9bfc Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 25 Jun 2018 19:04:07 +0200 Subject: [PATCH] Revert "Add language to dark sky weather component" (#15142) * Revert "Fix #14919. Should throw exception when camera stream closed by frontend (#15028)" This reverts commit 508d0459a7c188e87176e0ad57bed5d168e11050. * Revert "Fix pylintrc section order and option placements (#15120)" This reverts commit dbae410cf40f3a684ee5500b0691bed4c5c65204. * Revert "Add storage helper and migrate config entries (#15045)" This reverts commit ae51dc08bf5cb947d14b0e55fb64387b31924ac5. * Revert "Add language to dark sky weather component (#15130)" This reverts commit 672a3c7178afc91ac0da015f098dd5f96672e4f2. --- homeassistant/components/weather/darksky.py | 28 +++++---------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/homeassistant/components/weather/darksky.py b/homeassistant/components/weather/darksky.py index 86cc740edbc6bf..f0712542ea544b 100644 --- a/homeassistant/components/weather/darksky.py +++ b/homeassistant/components/weather/darksky.py @@ -25,22 +25,9 @@ ATTRIBUTION = "Powered by Dark Sky" -# Language Supported Codes -LANGUAGE_CODES = [ - 'ar', 'az', 'be', 'bg', 'bs', 'ca', - 'cs', 'da', 'de', 'el', 'en', 'es', - 'et', 'fi', 'fr', 'hr', 'hu', 'id', - 'is', 'it', 'ja', 'ka', 'kw', 'nb', - 'nl', 'pl', 'pt', 'ro', 'ru', 'sk', - 'sl', 'sr', 'sv', 'tet', 'tr', 'uk', - 'x-pig-latin', 'zh', 'zh-tw', -] - CONF_UNITS = 'units' -CONF_LANGUAGE = 'language' DEFAULT_NAME = 'Dark Sky' -DEFAULT_LANGUAGE = 'en' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_API_KEY): cv.string, @@ -48,8 +35,6 @@ vol.Optional(CONF_LONGITUDE): cv.longitude, vol.Optional(CONF_UNITS): vol.In(['auto', 'si', 'us', 'ca', 'uk', 'uk2']), vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, - vol.Optional(CONF_LANGUAGE, - default=DEFAULT_LANGUAGE): vol.In(LANGUAGE_CODES), }) MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=3) @@ -59,15 +44,15 @@ def setup_platform(hass, config, add_devices, discovery_info=None): """Set up the Dark Sky weather.""" latitude = config.get(CONF_LATITUDE, hass.config.latitude) longitude = config.get(CONF_LONGITUDE, hass.config.longitude) - name = config[CONF_NAME] - lang = config[CONF_LANGUAGE] - api_key = config[CONF_API_KEY] + name = config.get(CONF_NAME) units = config.get(CONF_UNITS) if not units: units = 'si' if hass.config.units.is_metric else 'us' - dark_sky = DarkSkyData(api_key, latitude, longitude, units, lang) + dark_sky = DarkSkyData( + config.get(CONF_API_KEY), latitude, longitude, units) + add_devices([DarkSkyWeather(name, dark_sky)], True) @@ -147,13 +132,12 @@ def update(self): class DarkSkyData(object): """Get the latest data from Dark Sky.""" - def __init__(self, api_key, latitude, longitude, units, lang): + def __init__(self, api_key, latitude, longitude, units): """Initialize the data object.""" self._api_key = api_key self.latitude = latitude self.longitude = longitude self.requested_units = units - self.language = lang self.data = None self.currently = None @@ -168,7 +152,7 @@ def update(self): try: self.data = forecastio.load_forecast( self._api_key, self.latitude, self.longitude, - units=self.requested_units, lang=self.language) + units=self.requested_units) self.currently = self.data.currently() self.hourly = self.data.hourly() self.daily = self.data.daily()