Remove unnecessary onewire variable (#42704)

This commit is contained in:
epenet 2020-11-03 09:07:22 +01:00 committed by GitHub
parent 5a4c1dbcc4
commit 744e4378ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,16 +76,14 @@ class OneWireProxy(OneWire):
def update(self):
"""Get the latest data from the device."""
value = None
value_read = False
try:
value_read = self._read_value_ownet()
self._value_raw = float(self._read_value_ownet())
except protocol.Error as exc:
_LOGGER.error("Owserver failure in read(), got: %s", exc)
if value_read:
else:
if "count" in self._unit_of_measurement:
value = int(value_read)
value = int(self._value_raw)
else:
value = round(float(value_read), 1)
self._value_raw = float(value_read)
value = round(self._value_raw, 1)
self._state = value