diff --git a/config/configuration.yaml.example b/config/configuration.yaml.example index 619b9f56f87..51217c090bb 100644 --- a/config/configuration.yaml.example +++ b/config/configuration.yaml.example @@ -118,4 +118,5 @@ sensor: - type: 'memory_use' - type: 'memory_free' - type: 'processor_use' - - type: 'unknown sensor type' \ No newline at end of file + - type: 'process' + arg: 'octave-cli' \ No newline at end of file diff --git a/homeassistant/components/http.py b/homeassistant/components/http.py index 46ef38d7423..bf8ea3b21de 100644 --- a/homeassistant/components/http.py +++ b/homeassistant/components/http.py @@ -111,7 +111,7 @@ def setup(hass, config=None): if config is None or DOMAIN not in config: config = {DOMAIN: {}} - api_password = config[DOMAIN].get(CONF_API_PASSWORD) + api_password = str(config[DOMAIN].get(CONF_API_PASSWORD)) no_password_set = api_password is None diff --git a/homeassistant/components/sensor/systemmonitor.py b/homeassistant/components/sensor/systemmonitor.py index ab7c2decbc7..3e560c95250 100644 --- a/homeassistant/components/sensor/systemmonitor.py +++ b/homeassistant/components/sensor/systemmonitor.py @@ -8,10 +8,11 @@ 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) + ATTR_UNIT_OF_MEASUREMENT, ATTR_FRIENDLY_NAME, STATE_ON, STATE_OFF) import psutil import logging + SENSOR_TYPES = { 'disk_use_percent': ['Disk Use', '%'], 'disk_use': ['Disk Use', 'GiB'], @@ -20,6 +21,7 @@ SENSOR_TYPES = { 'memory_use': ['RAM Use', 'MiB'], 'memory_free': ['RAM Free', 'MiB'], 'processor_use': ['CPU Use', '%'], + 'process': ['Process', ''], } _LOGGER = logging.getLogger(__name__) @@ -88,3 +90,8 @@ class SystemMonitorSensor(Device): self._state = round(psutil.virtual_memory().available / 1024**2, 1) elif self.type == 'processor_use': self._state = round(psutil.cpu_percent(interval=None)) + elif self.type == 'process': + if any(self.argument in l.name() for l in psutil.process_iter()): + self._state = STATE_ON + else: + self._state = STATE_OFF