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:
parent
3ca3fe7015
commit
d0da265166
2 changed files with 8 additions and 8 deletions
|
@ -19,7 +19,7 @@ from homeassistant.const import (
|
||||||
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['pynetio==0.1.6']
|
REQUIREMENTS = ['pynetio==0.1.9.1']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -151,15 +151,15 @@ class NetioSwitch(SwitchDevice):
|
||||||
|
|
||||||
def _set(self, value):
|
def _set(self, value):
|
||||||
val = list('uuuu')
|
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.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()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Return the switch's status."""
|
"""Return the switch's status."""
|
||||||
return self.netio.states[self.outlet - 1]
|
return self.netio.states[int(self.outlet) - 1]
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update the state."""
|
"""Update the state."""
|
||||||
|
@ -176,14 +176,14 @@ class NetioSwitch(SwitchDevice):
|
||||||
@property
|
@property
|
||||||
def current_power_w(self):
|
def current_power_w(self):
|
||||||
"""Return actual power."""
|
"""Return actual power."""
|
||||||
return self.netio.consumptions[self.outlet - 1]
|
return self.netio.consumptions[int(self.outlet) - 1]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cumulated_consumption_kwh(self):
|
def cumulated_consumption_kwh(self):
|
||||||
"""Return the total enerygy consumption since start_date."""
|
"""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
|
@property
|
||||||
def start_date(self):
|
def start_date(self):
|
||||||
"""Point in time when the energy accumulation started."""
|
"""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]
|
||||||
|
|
|
@ -1004,7 +1004,7 @@ pynello==1.5.1
|
||||||
pynetgear==0.4.2
|
pynetgear==0.4.2
|
||||||
|
|
||||||
# homeassistant.components.switch.netio
|
# homeassistant.components.switch.netio
|
||||||
pynetio==0.1.6
|
pynetio==0.1.9.1
|
||||||
|
|
||||||
# homeassistant.components.lock.nuki
|
# homeassistant.components.lock.nuki
|
||||||
pynuki==1.3.1
|
pynuki==1.3.1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue