1
0
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:
Paulus Schoutsen
2015-03-18 23:02:58 -07:00
parent 569b15d790
commit 9b643d57f0
23 changed files with 224 additions and 173 deletions

View File

@@ -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