From b1e8d484fdcea3b72e61e6ac60ba423221daea5f Mon Sep 17 00:00:00 2001 From: magico13 Date: Wed, 18 Aug 2021 14:43:38 -0400 Subject: [PATCH] Actually fixed this time --- custom_components/emporia_vue/__init__.py | 5 +++-- custom_components/emporia_vue/sensor.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/emporia_vue/__init__.py b/custom_components/emporia_vue/__init__.py index 14b3b83..bf792c7 100644 --- a/custom_components/emporia_vue/__init__.py +++ b/custom_components/emporia_vue/__init__.py @@ -102,6 +102,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): for device in devices: if not device.device_gid in device_gids: device_gids.append(device.device_gid) + # await loop.run_in_executor(None, vue.populate_device_properties, device) device_information[device.device_gid] = device else: device_information[device.device_gid].channels += device.channels @@ -259,7 +260,7 @@ async def update_sensors(vue, scales): def recurse_usage_data(usage_devices, scale, data): for gid, device in usage_devices.items(): - for channel_num, channel in device.channels: + for channel_num, channel in device.channels.items(): reset_datetime = None id = make_channel_id(channel, scale) info = find_device_info_for_channel(channel) @@ -282,7 +283,7 @@ def find_device_info_for_channel(channel): info = None if channel.device_gid in device_information: info = device_information[channel.device_gid] - if channel.channel_num in ["MainsFromGrid", "MainsToGrid"]: + if channel.channel_num in ["MainsFromGrid", "MainsToGrid", "Balance"]: found = False channel_123 = None for channel2 in info.channels: diff --git a/custom_components/emporia_vue/sensor.py b/custom_components/emporia_vue/sensor.py index a4b877b..18a05b5 100644 --- a/custom_components/emporia_vue/sensor.py +++ b/custom_components/emporia_vue/sensor.py @@ -73,7 +73,7 @@ class CurrentVuePowerSensor(CoordinatorEntity, SensorEntity): raise RuntimeError( f"No channel found for device_gid {device_gid} and channel_num {channel_num}" ) - dName = self._device.name + dName = self._device.device_name if self._channel.name and self._channel.name != "Main": dName = self._channel.name self._name = f"Power {dName} {channel_num} {self._scale}"