Use core constants for fixer (#46173)
parent
66ecd2e0f2
commit
5755598c95
|
@ -7,7 +7,7 @@ from fixerio.exceptions import FixerioException
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, CONF_NAME
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, CONF_NAME, CONF_TARGET
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
|
@ -17,8 +17,6 @@ ATTR_EXCHANGE_RATE = "Exchange rate"
|
|||
ATTR_TARGET = "Target currency"
|
||||
ATTRIBUTION = "Data provided by the European Central Bank (ECB)"
|
||||
|
||||
CONF_TARGET = "target"
|
||||
|
||||
DEFAULT_BASE = "USD"
|
||||
DEFAULT_NAME = "Exchange rate"
|
||||
|
||||
|
@ -37,7 +35,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up the Fixer.io sensor."""
|
||||
|
||||
api_key = config.get(CONF_API_KEY)
|
||||
name = config.get(CONF_NAME)
|
||||
target = config.get(CONF_TARGET)
|
||||
|
@ -103,7 +100,6 @@ class ExchangeData:
|
|||
|
||||
def __init__(self, target_currency, api_key):
|
||||
"""Initialize the data object."""
|
||||
|
||||
self.api_key = api_key
|
||||
self.rate = None
|
||||
self.target_currency = target_currency
|
||||
|
|
Loading…
Reference in New Issue