Only main and balance can be negative. Update sensor names to drop Power. Require HA 2021.9.

This commit is contained in:
magico13
2021-09-03 19:48:58 -04:00
parent e8a05ce37a
commit 192b6d3de8
4 changed files with 10 additions and 8 deletions

View File

@@ -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

View File

@@ -9,5 +9,6 @@
"homekit": {},
"dependencies": [],
"codeowners": ["@magico13"],
"version": "0.6.6"
"iot_class": "cloud_polling",
"version": "0.7.0"
}

View File

@@ -74,9 +74,9 @@ class CurrentVuePowerSensor(CoordinatorEntity, SensorEntity):
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

View File

@@ -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"
}