mirror of
https://github.com/magico13/ha-emporia-vue.git
synced 2026-01-08 20:07:56 -05:00
Only main and balance can be negative. Update sensor names to drop Power. Require HA 2021.9.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -9,5 +9,6 @@
|
||||
"homekit": {},
|
||||
"dependencies": [],
|
||||
"codeowners": ["@magico13"],
|
||||
"version": "0.6.6"
|
||||
"iot_class": "cloud_polling",
|
||||
"version": "0.7.0"
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user