diff --git a/homeassistant/components/switch/vesync.py b/homeassistant/components/switch/vesync.py index 382096ad5e4..d9ffbf9c12d 100644 --- a/homeassistant/components/switch/vesync.py +++ b/homeassistant/components/switch/vesync.py @@ -11,7 +11,7 @@ from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD) import homeassistant.helpers.config_validation as cv -REQUIREMENTS = ['pyvesync==0.1.1'] +REQUIREMENTS = ['pyvesync_v2==0.9.6'] _LOGGER = logging.getLogger(__name__) @@ -23,7 +23,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the VeSync switch platform.""" - from pyvesync.vesync import VeSync + from pyvesync_v2.vesync import VeSync switches = [] @@ -104,5 +104,6 @@ class VeSyncSwitchHA(SwitchDevice): def update(self): """Handle data changes for node values.""" self.smartplug.update() - self._current_power_w = self.smartplug.get_power() - self._today_energy_kwh = self.smartplug.get_kwh_today() + if self.smartplug.devtype == 'outlet': + self._current_power_w = self.smartplug.get_power() + self._today_energy_kwh = self.smartplug.get_kwh_today() diff --git a/requirements_all.txt b/requirements_all.txt index 2ef12c7f7be..8ae7c543653 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1439,7 +1439,7 @@ pyuptimerobot==0.0.5 pyvera==0.2.45 # homeassistant.components.switch.vesync -pyvesync==0.1.1 +pyvesync_v2==0.9.6 # homeassistant.components.media_player.vizio pyvizio==0.0.4