IOTA removal (#59380)
parent
d226df2511
commit
5418e76c84
|
@ -498,7 +498,6 @@ omit =
|
|||
homeassistant/components/incomfort/*
|
||||
homeassistant/components/intesishome/*
|
||||
homeassistant/components/ios/*
|
||||
homeassistant/components/iota/*
|
||||
homeassistant/components/iperf3/*
|
||||
homeassistant/components/iqvia/*
|
||||
homeassistant/components/irish_rail_transport/sensor.py
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
"""Support for IOTA wallets."""
|
||||
from datetime import timedelta
|
||||
|
||||
from iota import Iota
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.discovery import load_platform
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
CONF_IRI = "iri"
|
||||
CONF_TESTNET = "testnet"
|
||||
CONF_WALLET_NAME = "name"
|
||||
CONF_WALLET_SEED = "seed"
|
||||
CONF_WALLETS = "wallets"
|
||||
|
||||
DOMAIN = "iota"
|
||||
|
||||
IOTA_PLATFORMS = ["sensor"]
|
||||
|
||||
SCAN_INTERVAL = timedelta(minutes=10)
|
||||
|
||||
WALLET_CONFIG = vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_WALLET_NAME): cv.string,
|
||||
vol.Required(CONF_WALLET_SEED): cv.string,
|
||||
}
|
||||
)
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
{
|
||||
DOMAIN: vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_IRI): cv.string,
|
||||
vol.Optional(CONF_TESTNET, default=False): cv.boolean,
|
||||
vol.Required(CONF_WALLETS): vol.All(cv.ensure_list, [WALLET_CONFIG]),
|
||||
}
|
||||
)
|
||||
},
|
||||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
"""Set up the IOTA component."""
|
||||
iota_config = config[DOMAIN]
|
||||
|
||||
for platform in IOTA_PLATFORMS:
|
||||
load_platform(hass, platform, DOMAIN, iota_config, config)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
class IotaDevice(Entity):
|
||||
"""Representation of a IOTA device."""
|
||||
|
||||
def __init__(self, name, seed, iri, is_testnet=False):
|
||||
"""Initialise the IOTA device."""
|
||||
self._name = name
|
||||
self._seed = seed
|
||||
self.iri = iri
|
||||
self.is_testnet = is_testnet
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the default name of the device."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the device."""
|
||||
return {CONF_WALLET_NAME: self._name}
|
||||
|
||||
@property
|
||||
def api(self):
|
||||
"""Construct API object for interaction with the IRI node."""
|
||||
|
||||
return Iota(adapter=self.iri, seed=self._seed)
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"domain": "iota",
|
||||
"name": "IOTA",
|
||||
"documentation": "https://www.home-assistant.io/integrations/iota",
|
||||
"requirements": ["pyota==2.0.5"],
|
||||
"codeowners": [],
|
||||
"iot_class": "cloud_polling"
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
"""Support for IOTA wallet sensors."""
|
||||
from datetime import timedelta
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import CONF_NAME
|
||||
|
||||
from . import CONF_WALLETS, IotaDevice
|
||||
|
||||
ATTR_TESTNET = "testnet"
|
||||
ATTR_URL = "url"
|
||||
|
||||
CONF_IRI = "iri"
|
||||
CONF_SEED = "seed"
|
||||
CONF_TESTNET = "testnet"
|
||||
|
||||
SCAN_INTERVAL = timedelta(minutes=3)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up the IOTA sensor."""
|
||||
iota_config = discovery_info
|
||||
sensors = [
|
||||
IotaBalanceSensor(wallet, iota_config) for wallet in iota_config[CONF_WALLETS]
|
||||
]
|
||||
|
||||
sensors.append(IotaNodeSensor(iota_config=iota_config))
|
||||
|
||||
add_entities(sensors)
|
||||
|
||||
|
||||
class IotaBalanceSensor(IotaDevice, SensorEntity):
|
||||
"""Implement an IOTA sensor for displaying wallets balance."""
|
||||
|
||||
def __init__(self, wallet_config, iota_config):
|
||||
"""Initialize the sensor."""
|
||||
super().__init__(
|
||||
name=wallet_config[CONF_NAME],
|
||||
seed=wallet_config[CONF_SEED],
|
||||
iri=iota_config[CONF_IRI],
|
||||
is_testnet=iota_config[CONF_TESTNET],
|
||||
)
|
||||
self._state = None
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the sensor."""
|
||||
return f"{self._name} Balance"
|
||||
|
||||
@property
|
||||
def native_value(self):
|
||||
"""Return the state of the sensor."""
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def native_unit_of_measurement(self):
|
||||
"""Return the unit of measurement."""
|
||||
return "IOTA"
|
||||
|
||||
def update(self):
|
||||
"""Fetch new balance from IRI."""
|
||||
self._state = self.api.get_inputs()["totalBalance"]
|
||||
|
||||
|
||||
class IotaNodeSensor(IotaDevice, SensorEntity):
|
||||
"""Implement an IOTA sensor for displaying attributes of node."""
|
||||
|
||||
def __init__(self, iota_config):
|
||||
"""Initialize the sensor."""
|
||||
super().__init__(
|
||||
name="Node Info",
|
||||
seed=None,
|
||||
iri=iota_config[CONF_IRI],
|
||||
is_testnet=iota_config[CONF_TESTNET],
|
||||
)
|
||||
self._state = None
|
||||
self._attr = {ATTR_URL: self.iri, ATTR_TESTNET: self.is_testnet}
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the sensor."""
|
||||
return "IOTA Node"
|
||||
|
||||
@property
|
||||
def native_value(self):
|
||||
"""Return the state of the sensor."""
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the device."""
|
||||
return self._attr
|
||||
|
||||
def update(self):
|
||||
"""Fetch new attributes IRI node."""
|
||||
node_info = self.api.get_node_info()
|
||||
self._state = node_info.get("appVersion")
|
||||
|
||||
# convert values to raw string formats
|
||||
self._attr.update({k: str(v) for k, v in node_info.items()})
|
|
@ -1696,9 +1696,6 @@ pyopnsense==0.2.0
|
|||
# homeassistant.components.opple
|
||||
pyoppleio==1.0.5
|
||||
|
||||
# homeassistant.components.iota
|
||||
pyota==2.0.5
|
||||
|
||||
# homeassistant.components.opentherm_gw
|
||||
pyotgw==1.1b1
|
||||
|
||||
|
|
Loading…
Reference in New Issue