Closed boulwarek closed 2 years ago
Played around some more and set the cpu_usage to the following values to retrieve them as well: dict_get(previous_cpu, "ticks.total") = 2,147,483,647 dict_get(current_cpu, "ticks.total") = 2,147,483,647
These readings were taken a couple of minutes apart and they were both the same. Possibly these values are not updating correctly.
I then modified the following:
if previous_cpu is not None: current_cpu = dict_get(self._state, "telemetry.cpu") if ( dict_get(previous_cpu, "ticks.total") < dict_get(current_cpu, "ticks.total") ) and ( dict_get(previous_cpu, "ticks.idle") < dict_get(current_cpu, "ticks.idle")
Note that I changed the "<=" to "<" as this will prevent a zero value from being used. Now the CPU Usage entity is unavailable and not updating. Probably because these numbers are stagnant.
I rebooted my router at this point and the CPU Usage statistic re-populated correctly. It might be worth putting some logic in there to prevent division by zero even if these values are hung and not updating. At least the remainder of the entities will continue to work.
Thanks for bringing this up. I've got a fix queued up.
Fixed here: https://github.com/travisghansen/hass-pfsense/commit/c557539b2cbce63d91df805bd7e12cdbc47afa23 released in v0.5.0
.
PfSense 21.05 running on NetGate SG-3100 Was working fine for a few days and then started throwing this error message. Once this happens all entities become unavailable.
I temporarily modified line 367 to get the actual values of total_change and idle_change individually within the CPU Usage entity value total_change = 0 idle_change = 7451
The total_change value of 0 explains the error, but I am not sure if this is expected. Any tips on further troubleshooting?