Skip to content

Commit

Permalink
Only main and balance can be negative. Update sensor names to drop Po…
Browse files Browse the repository at this point in the history
…wer. Require HA 2021.9.
  • Loading branch information
magico13 committed Sep 3, 2021
1 parent e8a05ce commit 192b6d3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions custom_components/emporia_vue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,9 @@ def make_channel_id(channel, scale):


def fix_usage_sign(channel_num, usage):
"""If the channel is MainsToGrid we need it to be positive (see https://github.com/magico13/ha-emporia-vue/issues/57)"""
if usage and channel_num == "MainsToGrid":
return -1 * usage
"""If the channel is not '1,2,3' or 'Balance' we need it to be positive (see https://github.com/magico13/ha-emporia-vue/issues/57)"""
if usage and channel_num not in ["1,2,3", "Balance"]:
return abs(usage)
elif not usage:
usage = 0
return usage
3 changes: 2 additions & 1 deletion custom_components/emporia_vue/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"homekit": {},
"dependencies": [],
"codeowners": ["@magico13"],
"version": "0.6.6"
"iot_class": "cloud_polling",
"version": "0.7.0"
}
4 changes: 2 additions & 2 deletions custom_components/emporia_vue/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def __init__(self, coordinator, id):
f"No channel found for device_gid {device_gid} and channel_num {channel_num}"
)
dName = self._device.device_name
if self._channel.name and self._channel.name != "Main":
if self._channel.name and self._channel.name not in ["Main", "Balance"]:
dName = self._channel.name
self._name = f"Power {dName} {channel_num} {self._scale}"
self._name = f"{dName} {channel_num} {self._scale}"
self._iskwh = self.scale_is_energy()

@property
Expand Down
5 changes: 3 additions & 2 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Emporia Vue Integration",
"name": "Emporia Vue",
"domains": ["sensor", "switch"],
"iot_class": "Cloud Polling"
"iot_class": "Cloud Polling",
"homeassistant": "2021.9.0"
}

0 comments on commit 192b6d3

Please sign in to comment.