Fix sensor.systemmonitor

This commit is contained in:
Paulus Schoutsen 2015-09-13 23:29:13 -07:00
parent 965730eb60
commit 2df26a0d1a

View File

@ -59,7 +59,6 @@ arg
Additional details for the type, eg. path, binary name, etc. Additional details for the type, eg. path, binary name, etc.
""" """
import logging import logging
import psutil
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
@ -133,6 +132,7 @@ class SystemMonitorSensor(Entity):
# pylint: disable=too-many-branches # pylint: disable=too-many-branches
def update(self): def update(self):
import psutil
if self.type == 'disk_use_percent': if self.type == 'disk_use_percent':
self._state = psutil.disk_usage(self.argument).percent self._state = psutil.disk_usage(self.argument).percent
elif self.type == 'disk_use': elif self.type == 'disk_use':