mirror of
https://github.com/home-assistant/core.git
synced 2025-11-15 14:00:24 +00:00
Move attribution to standalone attribute [e-g] (#80513)
This commit is contained in:
@@ -7,14 +7,12 @@ from pyetherscan import get_balance
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_ADDRESS, CONF_NAME, CONF_TOKEN
|
||||
from homeassistant.const import CONF_ADDRESS, CONF_NAME, CONF_TOKEN
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
ATTRIBUTION = "Data provided by etherscan.io"
|
||||
|
||||
CONF_TOKEN_ADDRESS = "token_address"
|
||||
|
||||
SCAN_INTERVAL = timedelta(minutes=5)
|
||||
@@ -54,6 +52,8 @@ def setup_platform(
|
||||
class EtherscanSensor(SensorEntity):
|
||||
"""Representation of an Etherscan.io sensor."""
|
||||
|
||||
_attr_attribution = "Data provided by etherscan.io"
|
||||
|
||||
def __init__(self, name, address, token, token_address):
|
||||
"""Initialize the sensor."""
|
||||
self._name = name
|
||||
@@ -78,11 +78,6 @@ class EtherscanSensor(SensorEntity):
|
||||
"""Return the unit of measurement this sensor expresses itself in."""
|
||||
return self._unit_of_measurement
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the sensor."""
|
||||
return {ATTR_ATTRIBUTION: ATTRIBUTION}
|
||||
|
||||
def update(self) -> None:
|
||||
"""Get the latest state of the sensor."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user