Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade pyota to 2.0.5 #14442

Merged
merged 2 commits into from May 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/iota.py
Expand Up @@ -13,7 +13,7 @@
from homeassistant.helpers.discovery import load_platform
from homeassistant.helpers.entity import Entity

REQUIREMENTS = ['pyota==2.0.4']
REQUIREMENTS = ['pyota==2.0.5']

_LOGGER = logging.getLogger(__name__)

Expand Down
26 changes: 17 additions & 9 deletions homeassistant/components/sensor/iota.py
Expand Up @@ -7,10 +7,18 @@
import logging
from datetime import timedelta

from homeassistant.components.iota import IotaDevice
from homeassistant.components.iota import IotaDevice, CONF_WALLETS
from homeassistant.const import CONF_NAME

_LOGGER = logging.getLogger(__name__)

ATTR_TESTNET = 'testnet'
ATTR_URL = 'url'

CONF_IRI = 'iri'
CONF_SEED = 'seed'
CONF_TESTNET = 'testnet'

DEPENDENCIES = ['iota']

SCAN_INTERVAL = timedelta(minutes=3)
Expand All @@ -21,7 +29,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# Add sensors for wallet balance
iota_config = discovery_info
sensors = [IotaBalanceSensor(wallet, iota_config)
for wallet in iota_config['wallets']]
for wallet in iota_config[CONF_WALLETS]]

# Add sensor for node information
sensors.append(IotaNodeSensor(iota_config=iota_config))
Expand All @@ -34,10 +42,9 @@ class IotaBalanceSensor(IotaDevice):

def __init__(self, wallet_config, iota_config):
"""Initialize the sensor."""
super().__init__(name=wallet_config['name'],
seed=wallet_config['seed'],
iri=iota_config['iri'],
is_testnet=iota_config['testnet'])
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
Expand Down Expand Up @@ -65,10 +72,11 @@ class IotaNodeSensor(IotaDevice):

def __init__(self, iota_config):
"""Initialize the sensor."""
super().__init__(name='Node Info', seed=None, iri=iota_config['iri'],
is_testnet=iota_config['testnet'])
super().__init__(
name='Node Info', seed=None, iri=iota_config[CONF_IRI],
is_testnet=iota_config[CONF_TESTNET])
self._state = None
self._attr = {'url': self.iri, 'testnet': self.is_testnet}
self._attr = {ATTR_URL: self.iri, ATTR_TESTNET: self.is_testnet}

@property
def name(self):
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Expand Up @@ -891,7 +891,7 @@ pynut2==2.1.2
pynx584==0.4

# homeassistant.components.iota
pyota==2.0.4
pyota==2.0.5

# homeassistant.components.sensor.otp
pyotp==2.2.6
Expand Down