mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
switch to list
This commit is contained in:
parent
f9a8575414
commit
1d63e5a2df
@ -13,14 +13,14 @@ sensor:
|
|||||||
platform: openweathermap
|
platform: openweathermap
|
||||||
api_key: YOUR_APP_KEY
|
api_key: YOUR_APP_KEY
|
||||||
monitored_variables:
|
monitored_variables:
|
||||||
- type: 'weather'
|
- weather
|
||||||
- type: 'temperature'
|
- temperature
|
||||||
- type: 'wind_speed'
|
- wind_speed
|
||||||
- type: 'humidity'
|
- humidity
|
||||||
- type: 'pressure'
|
- pressure
|
||||||
- type: 'clouds'
|
- clouds
|
||||||
- type: 'rain'
|
- rain
|
||||||
- type: 'snow'
|
- snow
|
||||||
|
|
||||||
Variables:
|
Variables:
|
||||||
|
|
||||||
@ -28,16 +28,16 @@ api_key
|
|||||||
*Required
|
*Required
|
||||||
To retrieve this value log into your account at http://openweathermap.org/
|
To retrieve this value log into your account at http://openweathermap.org/
|
||||||
|
|
||||||
monitored_variables
|
monitored_conditions
|
||||||
*Required
|
*Required
|
||||||
An array specifying the variables to monitor.
|
An array specifying the variables to monitor.
|
||||||
|
|
||||||
These are the variables for the monitored_variables array:
|
These are the variables for the monitored_conditions array:
|
||||||
|
|
||||||
type
|
type
|
||||||
*Required
|
*Required
|
||||||
The variable you wish to monitor, see the configuration example above for a
|
The variable you wish to monitor, see the configuration example above for a
|
||||||
list of all available variables
|
list of all available conditions to monitor.
|
||||||
|
|
||||||
Details for the API : http://bugs.openweathermap.org/projects/api/wiki
|
Details for the API : http://bugs.openweathermap.org/projects/api/wiki
|
||||||
|
|
||||||
@ -49,7 +49,6 @@ from homeassistant.const import (CONF_API_KEY, TEMP_CELCIUS, TEMP_FAHRENHEIT)
|
|||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
_THROTTLED_REFRESH = None
|
|
||||||
SENSOR_TYPES = {
|
SENSOR_TYPES = {
|
||||||
'weather': ['Condition', ''],
|
'weather': ['Condition', ''],
|
||||||
'temperature': ['Temperature', ''],
|
'temperature': ['Temperature', ''],
|
||||||
@ -91,11 +90,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
dev = []
|
dev = []
|
||||||
for variable in config['monitored_variables']:
|
for variable in config['monitored_conditions']:
|
||||||
if variable['type'] not in SENSOR_TYPES:
|
if variable not in SENSOR_TYPES:
|
||||||
_LOGGER.error('Sensor type: "%s" does not exist', variable['type'])
|
_LOGGER.error('Sensor type: "%s" does not exist', variable)
|
||||||
else:
|
else:
|
||||||
dev.append(OpenWeatherMapSensor(variable['type'], obs, unit))
|
dev.append(OpenWeatherMapSensor(variable, obs, unit))
|
||||||
|
|
||||||
add_devices(dev)
|
add_devices(dev)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user