mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
ps: Add a global config object to Home Assistant
This commit is contained in:
@@ -7,8 +7,7 @@ Shows system monitor values such as: disk, memory and processor use
|
||||
"""
|
||||
|
||||
from homeassistant.helpers.device import Device
|
||||
from homeassistant.const import (
|
||||
ATTR_UNIT_OF_MEASUREMENT, ATTR_FRIENDLY_NAME, STATE_ON, STATE_OFF)
|
||||
from homeassistant.const import STATE_ON, STATE_OFF
|
||||
import psutil
|
||||
import logging
|
||||
|
||||
@@ -63,14 +62,6 @@ class SystemMonitorSensor(Device):
|
||||
""" Returns the state of the device. """
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def state_attributes(self):
|
||||
""" Returns the state attributes. """
|
||||
return {
|
||||
ATTR_FRIENDLY_NAME: self.name,
|
||||
ATTR_UNIT_OF_MEASUREMENT: self.unit_of_measurement,
|
||||
}
|
||||
|
||||
def update(self):
|
||||
if self.type == 'disk_use_percent':
|
||||
self._state = psutil.disk_usage(self.argument).percent
|
||||
|
||||
Reference in New Issue
Block a user