fix statement

This commit is contained in:
Fabian Affolter 2015-05-15 15:33:35 +02:00
parent 9c71970d69
commit 3939d4e2f0

View File

@ -22,7 +22,7 @@ sensor:
- type: 'rain' - type: 'rain'
- type: 'snow' - type: 'snow'
VARIABLES: Variables:
api_key api_key
*Required *Required
@ -42,7 +42,6 @@ list of all available variables
Details for the API : http://bugs.openweathermap.org/projects/api/wiki Details for the API : http://bugs.openweathermap.org/projects/api/wiki
Only metric measurements are supported at the moment. Only metric measurements are supported at the moment.
""" """
import logging import logging
@ -136,8 +135,7 @@ class OpenWeatherMapSensor(Entity):
if self.type == 'weather': if self.type == 'weather':
self._state = data.get_detailed_status() self._state = data.get_detailed_status()
elif self.type == 'temperature':
if self.type == 'temperature':
if self._unit == TEMP_CELCIUS: if self._unit == TEMP_CELCIUS:
self._state = round(data.get_temperature('celsius')['temp'], self._state = round(data.get_temperature('celsius')['temp'],
1) 1)
@ -146,26 +144,20 @@ class OpenWeatherMapSensor(Entity):
1) 1)
else: else:
self._state = round(data.get_temperature()['temp'], 1) self._state = round(data.get_temperature()['temp'], 1)
elif self.type == 'wind_speed': elif self.type == 'wind_speed':
self._state = data.get_wind()['speed'] self._state = data.get_wind()['speed']
elif self.type == 'humidity': elif self.type == 'humidity':
self._state = data.get_humidity() self._state = data.get_humidity()
elif self.type == 'pressure': elif self.type == 'pressure':
self._state = round(data.get_pressure()['press'], 0) self._state = round(data.get_pressure()['press'], 0)
elif self.type == 'clouds': elif self.type == 'clouds':
self._state = data.get_clouds() self._state = data.get_clouds()
elif self.type == 'rain': elif self.type == 'rain':
if data.get_rain(): if data.get_rain():
self._state = round(data.get_rain()['3h'], 0) self._state = round(data.get_rain()['3h'], 0)
else: else:
self._state = 'not raining' self._state = 'not raining'
self._unit_of_measurement = '' self._unit_of_measurement = ''
elif self.type == 'snow': elif self.type == 'snow':
if data.get_snow(): if data.get_snow():
self._state = round(data.get_snow(), 0) self._state = round(data.get_snow(), 0)