fix(sensor): fix rig temperature sensor state

- was short-circuiting after first device
- ignore inactive (-1) temperatures
This commit is contained in:
Brian Berg 2020-06-16 23:43:13 +00:00
parent 6c0a39e7c7
commit 2ef6ad9ac1

View File

@ -196,10 +196,10 @@ class NiceHashRigTemperatureSensor(Entity):
self._temps = [] self._temps = []
for device in devices: for device in devices:
temp = int(device.get("temperature")) temp = int(device.get("temperature"))
self._temps.append(temp)
if temp < 0: if temp < 0:
# Ignore inactive devices # Ignore inactive devices
continue continue
self._temps.append(temp)
if temp > highest_temp: if temp > highest_temp:
highest_temp = temp highest_temp = temp
return highest_temp return highest_temp