Remove since last boot from systemmonitor sensor (#18644)

* Remove since last boot

* Make systemmonitor last_boot be a timestamp
pull/18656/head
Paulus Schoutsen 2018-11-23 11:55:45 +01:00 committed by GitHub
parent 92978b2f26
commit c0cf29aba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 5 deletions

View File

@ -41,7 +41,6 @@ SENSOR_TYPES = {
'packets_out': ['Packets out', ' ', 'mdi:server-network'],
'process': ['Process', ' ', 'mdi:memory'],
'processor_use': ['Processor use', '%', 'mdi:memory'],
'since_last_boot': ['Since last boot', '', 'mdi:clock'],
'swap_free': ['Swap free', 'MiB', 'mdi:harddisk'],
'swap_use': ['Swap use', 'MiB', 'mdi:harddisk'],
'swap_use_percent': ['Swap use (percent)', '%', 'mdi:harddisk'],
@ -174,10 +173,7 @@ class SystemMonitorSensor(Entity):
elif self.type == 'last_boot':
self._state = dt_util.as_local(
dt_util.utc_from_timestamp(psutil.boot_time())
).date().isoformat()
elif self.type == 'since_last_boot':
self._state = dt_util.utcnow() - dt_util.utc_from_timestamp(
psutil.boot_time())
).isoformat()
elif self.type == 'load_1m':
self._state = os.getloadavg()[0]
elif self.type == 'load_5m':