Fix netio component (#17411)

* bump pynetio to 0.1.9.1 to actually use provided credentials.

* cast to int to fix TypeError

* update requirements_all.txt
This commit is contained in:
J4nsen 2018-10-13 21:09:10 +02:00 committed by Fabian Affolter
parent 3ca3fe7015
commit d0da265166
2 changed files with 8 additions and 8 deletions

View file

@ -19,7 +19,7 @@ from homeassistant.const import (
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['pynetio==0.1.6']
REQUIREMENTS = ['pynetio==0.1.9.1']
_LOGGER = logging.getLogger(__name__)
@ -151,15 +151,15 @@ class NetioSwitch(SwitchDevice):
def _set(self, value):
val = list('uuuu')
val[self.outlet - 1] = '1' if value else '0'
val[int(self.outlet) - 1] = '1' if value else '0'
self.netio.get('port list %s' % ''.join(val))
self.netio.states[self.outlet - 1] = value
self.netio.states[int(self.outlet) - 1] = value
self.schedule_update_ha_state()
@property
def is_on(self):
"""Return the switch's status."""
return self.netio.states[self.outlet - 1]
return self.netio.states[int(self.outlet) - 1]
def update(self):
"""Update the state."""
@ -176,14 +176,14 @@ class NetioSwitch(SwitchDevice):
@property
def current_power_w(self):
"""Return actual power."""
return self.netio.consumptions[self.outlet - 1]
return self.netio.consumptions[int(self.outlet) - 1]
@property
def cumulated_consumption_kwh(self):
"""Return the total enerygy consumption since start_date."""
return self.netio.cumulated_consumptions[self.outlet - 1]
return self.netio.cumulated_consumptions[int(self.outlet) - 1]
@property
def start_date(self):
"""Point in time when the energy accumulation started."""
return self.netio.start_dates[self.outlet - 1]
return self.netio.start_dates[int(self.outlet) - 1]

View file

@ -1004,7 +1004,7 @@ pynello==1.5.1
pynetgear==0.4.2
# homeassistant.components.switch.netio
pynetio==0.1.6
pynetio==0.1.9.1
# homeassistant.components.lock.nuki
pynuki==1.3.1