Remove attribution from extra state attributes (#76580)

This commit is contained in:
Franck Nijhof 2022-08-11 03:24:12 +02:00 committed by GitHub
parent 8ecbb85852
commit dbfba3a951
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 26 deletions

View file

@ -9,7 +9,7 @@ from fixerio.exceptions import FixerioException
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, CONF_NAME, CONF_TARGET
from homeassistant.const import CONF_API_KEY, CONF_NAME, CONF_TARGET
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -61,6 +61,8 @@ def setup_platform(
class ExchangeRateSensor(SensorEntity):
"""Representation of a Exchange sensor."""
_attr_attribution = ATTRIBUTION
def __init__(self, data, name, target):
"""Initialize the sensor."""
self.data = data
@ -88,7 +90,6 @@ class ExchangeRateSensor(SensorEntity):
"""Return the state attributes."""
if self.data.rate is not None:
return {
ATTR_ATTRIBUTION: ATTRIBUTION,
ATTR_EXCHANGE_RATE: self.data.rate["rates"][self._target],
ATTR_TARGET: self._target,
}