Move attribution to standalone attribute [c-d] (#80150)
This commit is contained in:
parent
237b03150e
commit
e9e3fb1cc8
9 changed files with 20 additions and 45 deletions
|
@ -8,13 +8,7 @@ import requests
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
CONF_API_KEY,
|
||||
CONF_BASE,
|
||||
CONF_NAME,
|
||||
CONF_QUOTE,
|
||||
)
|
||||
from homeassistant.const import CONF_API_KEY, CONF_BASE, CONF_NAME, CONF_QUOTE
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -23,8 +17,6 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
_RESOURCE = "http://apilayer.net/api/live"
|
||||
|
||||
ATTRIBUTION = "Data provided by currencylayer.com"
|
||||
|
||||
DEFAULT_BASE = "USD"
|
||||
DEFAULT_NAME = "CurrencyLayer Sensor"
|
||||
|
||||
|
@ -67,6 +59,8 @@ def setup_platform(
|
|||
class CurrencylayerSensor(SensorEntity):
|
||||
"""Implementing the Currencylayer sensor."""
|
||||
|
||||
_attr_attribution = "Data provided by currencylayer.com"
|
||||
|
||||
def __init__(self, rest, base, quote):
|
||||
"""Initialize the sensor."""
|
||||
self.rest = rest
|
||||
|
@ -94,11 +88,6 @@ class CurrencylayerSensor(SensorEntity):
|
|||
"""Return the state of the sensor."""
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the sensor."""
|
||||
return {ATTR_ATTRIBUTION: ATTRIBUTION}
|
||||
|
||||
def update(self) -> None:
|
||||
"""Update current date."""
|
||||
self.rest.update()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue