diff --git a/homeassistant/components/switch/vesync.py b/homeassistant/components/switch/vesync.py index fbc73545e19..d8579a508e2 100644 --- a/homeassistant/components/switch/vesync.py +++ b/homeassistant/components/switch/vesync.py @@ -60,6 +60,8 @@ class VeSyncSwitchHA(SwitchDevice): def __init__(self, plug): """Initialize the VeSync switch device.""" self.smartplug = plug + self._current_power_w = None + self._today_energy_kwh = None @property def unique_id(self): @@ -74,12 +76,12 @@ class VeSyncSwitchHA(SwitchDevice): @property def current_power_w(self): """Return the current power usage in W.""" - return self.smartplug.get_power() + return self._current_power_w @property def today_energy_kwh(self): """Return the today total energy usage in kWh.""" - return self.smartplug.get_kwh_today() + return self._today_energy_kwh @property def available(self) -> bool: @@ -102,3 +104,5 @@ 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()