Skip to content

Commit

Permalink
- Referenced new version of the low-level library
Browse files Browse the repository at this point in the history
- Minor fixes to sensor info
  • Loading branch information
albertogeniola committed Apr 4, 2020
1 parent 8f67b28 commit 651bf02
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion custom_components/meross_cloud/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from meross_iot.cloud.device import AbstractMerossDevice
from meross_iot.manager import MerossManager
from meross_iot.meross_event import DeviceOnlineStatusEvent, DeviceSwitchStatusEvent, MerossEvent, ClientConnectionEvent
from threading import Timer
from threading import Timer, Condition, RLock
import logging


Expand Down
2 changes: 1 addition & 1 deletion custom_components/meross_cloud/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"documentation": "https://www.home-assistant.io/components/meross_cloud",
"dependencies": ["persistent_notification"],
"codeowners": ["@albertogeniola"],
"requirements": ["meross_iot==0.3.2.20"],
"requirements": ["meross_iot==0.3.2.21"],
"config_flow": true,
"meross_cloud_version": "unknown"
}
10 changes: 8 additions & 2 deletions custom_components/meross_cloud/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@ def update(self):
self._device.get_status(force_status_refresh=False)
self._is_online = self._device.online

# Update electricity stats
if self._is_online:
# Update electricity stats only if the device is online and currently turned on
if self._is_online and self._device.get_status():
self._sensor_info = self._device.get_electricity()
else:
self._sensor_info = {
'voltage': 0,
'current': 0,
'power': 0
}

def force_state_update(self, ui_only=False):
if not self.enabled:
Expand Down

0 comments on commit 651bf02

Please sign in to comment.