mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 13:57:10 +00:00
Fix bugs in greeneye_monitor voltage reporting (#31895)
* Fix #31870 * Fix voltage notifications too
This commit is contained in:
parent
84e4ef510e
commit
f30c636fb7
@ -294,12 +294,10 @@ class VoltageSensor(GEMSensor):
|
|||||||
def __init__(self, monitor_serial_number, number, name):
|
def __init__(self, monitor_serial_number, number, name):
|
||||||
"""Construct the entity."""
|
"""Construct the entity."""
|
||||||
super().__init__(monitor_serial_number, name, "volts", number)
|
super().__init__(monitor_serial_number, name, "volts", number)
|
||||||
self._monitor = None
|
|
||||||
|
|
||||||
def _get_sensor(self, monitor):
|
def _get_sensor(self, monitor):
|
||||||
"""Wire the updates to a current channel."""
|
"""Wire the updates to the monitor itself, since there is no voltage element in the API."""
|
||||||
self._monitor = monitor
|
return monitor
|
||||||
return monitor.channels[self._number - 1]
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def icon(self):
|
def icon(self):
|
||||||
@ -309,10 +307,10 @@ class VoltageSensor(GEMSensor):
|
|||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the current voltage being reported by this sensor."""
|
"""Return the current voltage being reported by this sensor."""
|
||||||
if not self._monitor.voltage:
|
if not self._sensor:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return self._monitor.voltage
|
return self._sensor.voltage
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unit_of_measurement(self):
|
def unit_of_measurement(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user