feat(sensors): record all device temperatures

- stop attempting to ignore inactive/disabled devices
- remove active devices count attribute
- minor import cleanup
This commit is contained in:
Brian Berg 2020-06-17 02:07:23 +00:00
parent 7ca95d8ca2
commit 04820e1aa9
3 changed files with 0 additions and 15 deletions

View File

@ -51,4 +51,3 @@ CURRENCY_EUR = "EUR"
BALANCE_TYPE_AVAILABLE = "available"
BALANCE_TYPE_PENDING = "pending"
BALANCE_TYPE_TOTAL = "total"
DEVICE_STATUS_INACTIVE = "INACTIVE"

View File

@ -16,13 +16,7 @@ from .const import (
CURRENCY_BTC,
CURRENCY_EUR,
CURRENCY_USD,
DEFAULT_NAME,
DEVICE_STATUS_INACTIVE,
DOMAIN,
ICON_CURRENCY_BTC,
ICON_CURRENCY_EUR,
ICON_CURRENCY_USD,
ICON_TEMPERATURE,
)
from .nicehash import NiceHashPrivateClient, NiceHashPublicClient
from .sensors import NiceHashBalanceSensor, NiceHashRigTemperatureSensor

View File

@ -142,7 +142,6 @@ class NiceHashRigTemperatureSensor(Entity):
self._name = rig["name"]
self._temps = []
self._num_devices = 0
self._num_active_devices = 0
_LOGGER.debug(f"Mining Rig Temperature Sensor: {self._name} ({self._rig_id})")
@property
@ -179,16 +178,10 @@ class NiceHashRigTemperatureSensor(Entity):
if self._num_devices > 0:
_LOGGER.debug(f"{self._name}: Found {self._num_devices} devices")
for device in devices:
status = device.get("status").get("enumName")
# Ignore inactive devices
if status == DEVICE_STATUS_INACTIVE:
continue
temp = int(device.get("temperature"))
self._temps.append(temp)
if temp > highest_temp:
highest_temp = temp
self._num_active_devices = len(self._temps)
return highest_temp
else:
_LOGGER.debug(f"{self._name}: No devices found")
@ -215,7 +208,6 @@ class NiceHashRigTemperatureSensor(Entity):
return {
ATTR_ATTRIBUTION: ATTRIBUTION,
"temperatures": self._temps,
"active_devices": self._num_active_devices,
"total_devices": self._num_devices,
}