From d001411119b81022462fa706a67a9ecc3fdf00ac Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 29 Sep 2026 08:43:07 +0200 Subject: [PATCH] Remove Etherscan integration (#183509) --- .../components/etherscan/__init__.py | 1 - .../components/etherscan/manifest.json | 10 -- homeassistant/components/etherscan/sensor.py | 95 ------------------- homeassistant/generated/integrations.json | 6 -- requirements_all.txt | 3 - script/hassfest/quality_scale.py | 2 - 6 files changed, 117 deletions(-) delete mode 100644 homeassistant/components/etherscan/__init__.py delete mode 100644 homeassistant/components/etherscan/manifest.json delete mode 100644 homeassistant/components/etherscan/sensor.py diff --git a/homeassistant/components/etherscan/__init__.py b/homeassistant/components/etherscan/__init__.py deleted file mode 100644 index b7665204e229..000000000000 --- a/homeassistant/components/etherscan/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""The Etherscan integration.""" diff --git a/homeassistant/components/etherscan/manifest.json b/homeassistant/components/etherscan/manifest.json deleted file mode 100644 index e5099ffaf9c0..000000000000 --- a/homeassistant/components/etherscan/manifest.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "domain": "etherscan", - "name": "Etherscan", - "codeowners": [], - "documentation": "https://www.home-assistant.io/integrations/etherscan", - "iot_class": "cloud_polling", - "loggers": ["pyetherscan"], - "quality_scale": "legacy", - "requirements": ["python-etherscan-api==0.0.3"] -} diff --git a/homeassistant/components/etherscan/sensor.py b/homeassistant/components/etherscan/sensor.py deleted file mode 100644 index 363060432b7f..000000000000 --- a/homeassistant/components/etherscan/sensor.py +++ /dev/null @@ -1,95 +0,0 @@ -"""Support for Etherscan sensors.""" - -from datetime import timedelta -from typing import override - -import probatio -from pyetherscan import get_balance - -from homeassistant.components.sensor import ( - PLATFORM_SCHEMA as SENSOR_PLATFORM_SCHEMA, - SensorEntity, -) -from homeassistant.const import CONF_ADDRESS, CONF_NAME, CONF_TOKEN -from homeassistant.core import HomeAssistant -from homeassistant.helpers import config_validation as cv -from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType - -CONF_TOKEN_ADDRESS = "token_address" - -SCAN_INTERVAL = timedelta(minutes=5) - -PLATFORM_SCHEMA = SENSOR_PLATFORM_SCHEMA.extend( - { - probatio.Required(CONF_ADDRESS): cv.string, - probatio.Optional(CONF_NAME): cv.string, - probatio.Optional(CONF_TOKEN): cv.string, - probatio.Optional(CONF_TOKEN_ADDRESS): cv.string, - } -) - - -def setup_platform( - hass: HomeAssistant, - config: ConfigType, - add_entities: AddEntitiesCallback, - discovery_info: DiscoveryInfoType | None = None, -) -> None: - """Set up the Etherscan.io sensors.""" - address = config.get(CONF_ADDRESS) - name = config.get(CONF_NAME) - token = config.get(CONF_TOKEN) - token_address = config.get(CONF_TOKEN_ADDRESS) - - if token: - token = token.upper() - if not name: - name = f"{token} Balance" - if not name: - name = "ETH Balance" - - add_entities([EtherscanSensor(name, address, token, token_address)], True) - - -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 - self._address = address - self._token_address = token_address - self._token = token - self._state = None - self._unit_of_measurement = self._token or "ETH" - - @property - @override - def name(self): - """Return the name of the sensor.""" - return self._name - - @property - @override - def native_value(self): - """Return the state of the sensor.""" - return self._state - - @property - @override - def native_unit_of_measurement(self): - """Return the unit of measurement this sensor expresses itself in.""" - return self._unit_of_measurement - - def update(self) -> None: - """Get the latest state of the sensor.""" - - if self._token_address: - self._state = get_balance(self._address, self._token_address) - elif self._token: - self._state = get_balance(self._address, self._token) - else: - self._state = get_balance(self._address) diff --git a/homeassistant/generated/integrations.json b/homeassistant/generated/integrations.json index ef7a0e9e4d22..63335bcaf764 100644 --- a/homeassistant/generated/integrations.json +++ b/homeassistant/generated/integrations.json @@ -1987,12 +1987,6 @@ "iot_class": "cloud_polling", "single_config_entry": true }, - "etherscan": { - "name": "Etherscan", - "integration_type": "hub", - "config_flow": false, - "iot_class": "cloud_polling" - }, "eufy": { "name": "eufy", "integrations": { diff --git a/requirements_all.txt b/requirements_all.txt index 7ca2c592c0d9..738c4a175426 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2716,9 +2716,6 @@ python-duco-connectivity==0.18.0 # homeassistant.components.ecobee python-ecobee-api==0.4.1 -# homeassistant.components.etherscan -python-etherscan-api==0.0.3 - # homeassistant.components.familyhub python-family-hub-local==0.0.2 diff --git a/script/hassfest/quality_scale.py b/script/hassfest/quality_scale.py index 9a9805e808fe..1e471e09599d 100644 --- a/script/hassfest/quality_scale.py +++ b/script/hassfest/quality_scale.py @@ -316,7 +316,6 @@ INTEGRATIONS_WITHOUT_QUALITY_SCALE_FILE = [ "epson", "eq3btsmart", "escea", - "etherscan", "eufy", "eufylife_ble", "everlights", @@ -1231,7 +1230,6 @@ INTEGRATIONS_WITHOUT_SCALE = [ "epson", "eq3btsmart", "escea", - "etherscan", "eufy", "eufylife_ble", "everlights",