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

Fix netio component #17411

Merged
merged 3 commits into from Oct 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
14 changes: 7 additions & 7 deletions homeassistant/components/switch/netio.py
Expand Up @@ -19,7 +19,7 @@
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__)

Expand Down Expand Up @@ -151,15 +151,15 @@ def turn_off(self, **kwargs):

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."""
Expand All @@ -176,14 +176,14 @@ def state_attributes(self):
@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]
2 changes: 1 addition & 1 deletion requirements_all.txt
Expand Up @@ -1000,7 +1000,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
Expand Down