Skip to content

Commit

Permalink
fix custom sensors not having a tag property
Browse files Browse the repository at this point in the history
  • Loading branch information
hekmon committed Aug 7, 2022
1 parent 02965ba commit 9550e94
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,12 @@ class ADCOSensor(SensorEntity):
def __init__(self, serial_reader):
_LOGGER.debug("initializing ADCO sensor")
self._serial_controller = serial_reader
self._tag = "ADCO"

@property
def native_value(self) -> str | None:
"""Value of the sensor"""
value, _ = self._serial_controller.get_values("ADCO")
value, _ = self._serial_controller.get_values(self._tag)
_LOGGER.debug(
"recovered ADCO value from serial controller: %s", value)
if value is None:
Expand Down Expand Up @@ -374,11 +375,12 @@ class PEJPSensor(SensorEntity):
def __init__(self, serial_reader):
_LOGGER.debug("initializing PEJP sensor")
self._serial_controller = serial_reader
self._tag = "PEJP"

@property
def native_value(self) -> str | None:
"""Value of the sensor"""
value, _ = self._serial_controller.get_values("PEJP")
value, _ = self._serial_controller.get_values(self._tag)
return value

@callback
Expand Down

0 comments on commit 9550e94

Please sign in to comment.