mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Round system monitor load averages to 2 decimal digits (#27558)
On a Raspberry Pi 3, Python 3.7.4: # python3 -c "import os; print(os.getloadavg())" (0.2724609375, 0.3505859375, 0.3515625)
This commit is contained in:
parent
4d8539e151
commit
7431e26752
@ -218,8 +218,8 @@ class SystemMonitorSensor(Entity):
|
|||||||
dt_util.utc_from_timestamp(psutil.boot_time())
|
dt_util.utc_from_timestamp(psutil.boot_time())
|
||||||
).isoformat()
|
).isoformat()
|
||||||
elif self.type == "load_1m":
|
elif self.type == "load_1m":
|
||||||
self._state = os.getloadavg()[0]
|
self._state = round(os.getloadavg()[0], 2)
|
||||||
elif self.type == "load_5m":
|
elif self.type == "load_5m":
|
||||||
self._state = os.getloadavg()[1]
|
self._state = round(os.getloadavg()[1], 2)
|
||||||
elif self.type == "load_15m":
|
elif self.type == "load_15m":
|
||||||
self._state = os.getloadavg()[2]
|
self._state = round(os.getloadavg()[2], 2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user