diff --git a/homeassistant/components/sensor/glances.py b/homeassistant/components/sensor/glances.py index 2d1edbd1bb1b..831f6ca89d89 100644 --- a/homeassistant/components/sensor/glances.py +++ b/homeassistant/components/sensor/glances.py @@ -28,21 +28,21 @@ DEFAULT_PORT = '61208' MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=1) SENSOR_TYPES = { - 'disk_use_percent': ['Disk used', '%'], - 'disk_use': ['Disk used', 'GiB'], - 'disk_free': ['Disk free', 'GiB'], - 'memory_use_percent': ['RAM used', '%'], - 'memory_use': ['RAM used', 'MiB'], - 'memory_free': ['RAM free', 'MiB'], - 'swap_use_percent': ['Swap used', '%'], - 'swap_use': ['Swap used', 'GiB'], - 'swap_free': ['Swap free', 'GiB'], - 'processor_load': ['CPU load', '15 min'], - 'process_running': ['Running', 'Count'], - 'process_total': ['Total', 'Count'], - 'process_thread': ['Thread', 'Count'], - 'process_sleeping': ['Sleeping', 'Count'], - 'cpu_temp': ['CPU Temp', TEMP_CELSIUS], + 'disk_use_percent': ['Disk used', '%', 'mdi:harddisk'], + 'disk_use': ['Disk used', 'GiB', 'mdi:harddisk'], + 'disk_free': ['Disk free', 'GiB', 'mdi:harddisk'], + 'memory_use_percent': ['RAM used', '%', 'mdi:memory'], + 'memory_use': ['RAM used', 'MiB', 'mdi:memory'], + 'memory_free': ['RAM free', 'MiB', 'mdi:memory'], + 'swap_use_percent': ['Swap used', '%', 'mdi:memory'], + 'swap_use': ['Swap used', 'GiB', 'mdi:memory'], + 'swap_free': ['Swap free', 'GiB', 'mdi:memory'], + 'processor_load': ['CPU load', '15 min', 'mdi:memory'], + 'process_running': ['Running', 'Count', 'mdi:memory'], + 'process_total': ['Total', 'Count', 'mdi:memory'], + 'process_thread': ['Thread', 'Count', 'mdi:memory'], + 'process_sleeping': ['Sleeping', 'Count', 'mdi:memory'], + 'cpu_temp': ['CPU Temp', TEMP_CELSIUS, 'mdi:thermometer'], } PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ @@ -87,10 +87,13 @@ class GlancesSensor(Entity): @property def name(self): """Return the name of the sensor.""" - if self._name is None: - return SENSOR_TYPES[self.type][0] return '{} {}'.format(self._name, SENSOR_TYPES[self.type][0]) + @property + def icon(self): + """Icon to use in the frontend, if any.""" + return SENSOR_TYPES[self.type][2] + @property def unit_of_measurement(self): """Return the unit the value is expressed in."""