Add/adjust attribution of sensor platform (#3719)
* Add/adjust attribution * Fix typo
This commit is contained in:
1 parent
7cf2c48175
commit
8ded8f572a
12 files changed
+101
-57
No files matched your search
@@ -12,7 +12,7 @@ import voluptuous as vol
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import (
|
||||
CONF_API_KEY, CONF_NAME, TEMP_CELSIUS, TEMP_FAHRENHEIT,
|
||||
CONF_MONITORED_CONDITIONS)
|
||||
CONF_MONITORED_CONDITIONS, ATTR_ATTRIBUTION)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
@@ -21,6 +21,7 @@ REQUIREMENTS = ['pyowm==2.5.0']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
CONF_ATTRIBUTION = "Data provied by OpenWeatherMap"
|
||||
CONF_FORECAST = 'forecast'
|
||||
|
||||
DEFAULT_NAME = 'OWM'
|
||||
@@ -113,6 +114,13 @@ class OpenWeatherMapSensor(Entity):
|
||||
"""Return the unit of measurement of this entity, if any."""
|
||||
return self._unit_of_measurement
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {
|
||||
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
|
||||
}
|
||||
|
||||
# pylint: disable=too-many-branches
|
||||
def update(self):
|
||||
"""Get the latest data from OWM and updates the states."""
|
||||
|
||||
Reference in new issue
Block a user