From 6bf4532608eef61fd349e48da038343d50dc2236 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 5 Feb 2016 13:08:17 +0100 Subject: [PATCH] Add icon --- homeassistant/components/sensor/cpuspeed.py | 6 ++++++ homeassistant/components/sensor/worldclock.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/homeassistant/components/sensor/cpuspeed.py b/homeassistant/components/sensor/cpuspeed.py index cdfb6b5c874a..54bb5e3bc2ca 100644 --- a/homeassistant/components/sensor/cpuspeed.py +++ b/homeassistant/components/sensor/cpuspeed.py @@ -19,6 +19,7 @@ DEFAULT_NAME = "CPU speed" ATTR_VENDOR = 'Vendor ID' ATTR_BRAND = 'Brand' ATTR_HZ = 'GHz Advertised' +ICON = 'mdi:pulse' # pylint: disable=unused-variable @@ -62,6 +63,11 @@ class CpuSpeedSensor(Entity): ATTR_HZ: round(self.info['hz_advertised_raw'][0]/10**9, 2) } + @property + def icon(self): + """ Icon to use in the frontend, if any. """ + return ICON + def update(self): """ Gets the latest data and updates the state. """ from cpuinfo import cpuinfo diff --git a/homeassistant/components/sensor/worldclock.py b/homeassistant/components/sensor/worldclock.py index c7d015785703..13ec4c2fb214 100644 --- a/homeassistant/components/sensor/worldclock.py +++ b/homeassistant/components/sensor/worldclock.py @@ -14,6 +14,7 @@ from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = "Worldclock Sensor" +ICON = 'mdi:clock' def setup_platform(hass, config, add_devices, discovery_info=None): @@ -54,6 +55,11 @@ class WorldClockSensor(Entity): """ Returns the state of the device. """ return self._state + @property + def icon(self): + """ Icon to use in the frontend, if any. """ + return ICON + def update(self): """ Gets the time and updates the states. """ self._state = dt_util.datetime_to_time_str(