Use device name as set in app in display name

This commit is contained in:
magico13
2020-05-20 23:05:48 -04:00
parent 82907751b3
commit 57b99e9a1f
2 changed files with 6 additions and 4 deletions

View File

@@ -4,7 +4,7 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/emporia_vue",
"requirements": [
"pyemvue==0.9.3"
"pyemvue==0.9.5"
],
"ssdp": [],
"zeroconf": [],

View File

@@ -17,8 +17,9 @@ async def async_setup_entry(hass, config_entry, add_entities):
# Add a sensor for each device channel
devices = []
for device in vue_devices:
device = vue.populate_device_properties(device)
for channel in device.channels:
devices.append(CurrentVuePowerSensor(vue, channel))
devices.append(CurrentVuePowerSensor(vue, device, channel))
add_entities(devices)
@@ -26,16 +27,17 @@ async def async_setup_entry(hass, config_entry, add_entities):
class CurrentVuePowerSensor(Entity):
"""Representation of a Vue Sensor's current power."""
def __init__(self, vue, channel):
def __init__(self, vue, device, channel):
"""Initialize the sensor."""
self._state = None
self._vue = vue
self._device = device
self._channel = channel
@property
def name(self):
"""Return the name of the sensor."""
return f'Power {self._channel.device_gid} {self._channel.channel_num}'
return f'Power {self._device.device_name} {self._channel.channel_num}'
@property
def state(self):