mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
parent
eb4a44535c
commit
3e7b908a61
@ -4,6 +4,7 @@ Weather component that handles meteorological data for your location.
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/weather/
|
||||
"""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
@ -14,11 +15,6 @@ from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DEPENDENCIES = []
|
||||
DOMAIN = 'weather'
|
||||
|
||||
ENTITY_ID_FORMAT = DOMAIN + '.{}'
|
||||
|
||||
ATTR_CONDITION_CLASS = 'condition_class'
|
||||
ATTR_FORECAST = 'forecast'
|
||||
ATTR_FORECAST_CONDITION = 'condition'
|
||||
@ -26,8 +22,8 @@ ATTR_FORECAST_PRECIPITATION = 'precipitation'
|
||||
ATTR_FORECAST_TEMP = 'temperature'
|
||||
ATTR_FORECAST_TEMP_LOW = 'templow'
|
||||
ATTR_FORECAST_TIME = 'datetime'
|
||||
ATTR_FORECAST_WIND_SPEED = 'wind_speed'
|
||||
ATTR_FORECAST_WIND_BEARING = 'wind_bearing'
|
||||
ATTR_FORECAST_WIND_SPEED = 'wind_speed'
|
||||
ATTR_WEATHER_ATTRIBUTION = 'attribution'
|
||||
ATTR_WEATHER_HUMIDITY = 'humidity'
|
||||
ATTR_WEATHER_OZONE = 'ozone'
|
||||
@ -37,10 +33,17 @@ ATTR_WEATHER_VISIBILITY = 'visibility'
|
||||
ATTR_WEATHER_WIND_BEARING = 'wind_bearing'
|
||||
ATTR_WEATHER_WIND_SPEED = 'wind_speed'
|
||||
|
||||
DOMAIN = 'weather'
|
||||
|
||||
ENTITY_ID_FORMAT = DOMAIN + '.{}'
|
||||
|
||||
SCAN_INTERVAL = timedelta(seconds=30)
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
"""Set up the weather component."""
|
||||
component = hass.data[DOMAIN] = EntityComponent(_LOGGER, DOMAIN, hass)
|
||||
component = hass.data[DOMAIN] = EntityComponent(
|
||||
_LOGGER, DOMAIN, hass, SCAN_INTERVAL)
|
||||
await component.async_setup(config)
|
||||
return True
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user