From 518001f00b92d24a699e9039e5c066f7c9795fb1 Mon Sep 17 00:00:00 2001 From: Franck Nijhof <git@frenck.dev> Date: Wed, 20 Jul 2022 18:58:48 +0200 Subject: [PATCH] Remove SoChain integration (#75505) --- .coveragerc | 1 - homeassistant/components/sochain/__init__.py | 1 - .../components/sochain/manifest.json | 10 --- homeassistant/components/sochain/sensor.py | 88 ------------------- 4 files changed, 100 deletions(-) delete mode 100644 homeassistant/components/sochain/__init__.py delete mode 100644 homeassistant/components/sochain/manifest.json delete mode 100644 homeassistant/components/sochain/sensor.py diff --git a/.coveragerc b/.coveragerc index 0dd9f18af34..f266e557e59 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1110,7 +1110,6 @@ omit = homeassistant/components/smtp/notify.py homeassistant/components/snapcast/* homeassistant/components/snmp/* - homeassistant/components/sochain/sensor.py homeassistant/components/solaredge/__init__.py homeassistant/components/solaredge/coordinator.py homeassistant/components/solaredge/sensor.py diff --git a/homeassistant/components/sochain/__init__.py b/homeassistant/components/sochain/__init__.py deleted file mode 100644 index 31a000d3947..00000000000 --- a/homeassistant/components/sochain/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""The sochain component.""" diff --git a/homeassistant/components/sochain/manifest.json b/homeassistant/components/sochain/manifest.json deleted file mode 100644 index 5a568340197..00000000000 --- a/homeassistant/components/sochain/manifest.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "disabled": "Integration library depends on async_timeout==3.x.x", - "domain": "sochain", - "name": "SoChain", - "documentation": "https://www.home-assistant.io/integrations/sochain", - "requirements": ["python-sochain-api==0.0.2"], - "codeowners": [], - "iot_class": "cloud_polling", - "loggers": ["pysochain"] -} diff --git a/homeassistant/components/sochain/sensor.py b/homeassistant/components/sochain/sensor.py deleted file mode 100644 index 157d94b8706..00000000000 --- a/homeassistant/components/sochain/sensor.py +++ /dev/null @@ -1,88 +0,0 @@ -"""Support for watching multiple cryptocurrencies.""" -# pylint: disable=import-error -from __future__ import annotations - -from datetime import timedelta - -from pysochain import ChainSo -import voluptuous as vol - -from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity -from homeassistant.const import ATTR_ATTRIBUTION, CONF_ADDRESS, CONF_NAME -from homeassistant.core import HomeAssistant -from homeassistant.helpers.aiohttp_client import async_get_clientsession -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 chain.so" - -CONF_NETWORK = "network" - -DEFAULT_NAME = "Crypto Balance" - -SCAN_INTERVAL = timedelta(minutes=5) - -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( - { - vol.Required(CONF_ADDRESS): cv.string, - vol.Required(CONF_NETWORK): cv.string, - vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, - } -) - - -async def async_setup_platform( - hass: HomeAssistant, - config: ConfigType, - async_add_entities: AddEntitiesCallback, - discovery_info: DiscoveryInfoType | None = None, -) -> None: - """Set up the sochain sensors.""" - - address = config[CONF_ADDRESS] - network = config[CONF_NETWORK] - name = config[CONF_NAME] - - session = async_get_clientsession(hass) - chainso = ChainSo(network, address, hass.loop, session) - - async_add_entities([SochainSensor(name, network.upper(), chainso)], True) - - -class SochainSensor(SensorEntity): - """Representation of a Sochain sensor.""" - - def __init__(self, name, unit_of_measurement, chainso): - """Initialize the sensor.""" - self._name = name - self._unit_of_measurement = unit_of_measurement - self.chainso = chainso - - @property - def name(self): - """Return the name of the sensor.""" - return self._name - - @property - def native_value(self): - """Return the state of the sensor.""" - return ( - self.chainso.data.get("confirmed_balance") - if self.chainso is not None - else None - ) - - @property - def native_unit_of_measurement(self): - """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} - - async def async_update(self): - """Get the latest state of the sensor.""" - await self.chainso.async_get_data() -- GitLab