diff --git a/homeassistant/components/frontend/www_static/images/darksky/weather-cloudy.svg b/homeassistant/components/frontend/www_static/images/darksky/weather-cloudy.svg
new file mode 100644
index 00000000000..a0c80c53611
--- /dev/null
+++ b/homeassistant/components/frontend/www_static/images/darksky/weather-cloudy.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/homeassistant/components/frontend/www_static/images/darksky/weather-fog.svg b/homeassistant/components/frontend/www_static/images/darksky/weather-fog.svg
new file mode 100644
index 00000000000..42571dfb738
--- /dev/null
+++ b/homeassistant/components/frontend/www_static/images/darksky/weather-fog.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/homeassistant/components/frontend/www_static/images/darksky/weather-hail.svg b/homeassistant/components/frontend/www_static/images/darksky/weather-hail.svg
new file mode 100644
index 00000000000..7934e54f7ae
--- /dev/null
+++ b/homeassistant/components/frontend/www_static/images/darksky/weather-hail.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/homeassistant/components/frontend/www_static/images/darksky/weather-night.svg b/homeassistant/components/frontend/www_static/images/darksky/weather-night.svg
new file mode 100644
index 00000000000..d880912be93
--- /dev/null
+++ b/homeassistant/components/frontend/www_static/images/darksky/weather-night.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/homeassistant/components/frontend/www_static/images/darksky/weather-partlycloudy.svg b/homeassistant/components/frontend/www_static/images/darksky/weather-partlycloudy.svg
new file mode 100644
index 00000000000..af93dfa0b2a
--- /dev/null
+++ b/homeassistant/components/frontend/www_static/images/darksky/weather-partlycloudy.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/homeassistant/components/frontend/www_static/images/darksky/weather-pouring.svg b/homeassistant/components/frontend/www_static/images/darksky/weather-pouring.svg
new file mode 100644
index 00000000000..bf20e9bc0c9
--- /dev/null
+++ b/homeassistant/components/frontend/www_static/images/darksky/weather-pouring.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/homeassistant/components/frontend/www_static/images/darksky/weather-rainy.svg b/homeassistant/components/frontend/www_static/images/darksky/weather-rainy.svg
new file mode 100644
index 00000000000..27ae4d033ff
--- /dev/null
+++ b/homeassistant/components/frontend/www_static/images/darksky/weather-rainy.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/homeassistant/components/frontend/www_static/images/darksky/weather-snowy.svg b/homeassistant/components/frontend/www_static/images/darksky/weather-snowy.svg
new file mode 100644
index 00000000000..9c56c2bb469
--- /dev/null
+++ b/homeassistant/components/frontend/www_static/images/darksky/weather-snowy.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/homeassistant/components/frontend/www_static/images/darksky/weather-sunny.svg b/homeassistant/components/frontend/www_static/images/darksky/weather-sunny.svg
new file mode 100644
index 00000000000..8f9733041a1
--- /dev/null
+++ b/homeassistant/components/frontend/www_static/images/darksky/weather-sunny.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/homeassistant/components/frontend/www_static/images/darksky/weather-windy.svg b/homeassistant/components/frontend/www_static/images/darksky/weather-windy.svg
new file mode 100644
index 00000000000..de0b444fd01
--- /dev/null
+++ b/homeassistant/components/frontend/www_static/images/darksky/weather-windy.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/homeassistant/components/sensor/darksky.py b/homeassistant/components/sensor/darksky.py
index 3e18d965cb0..478e3251b52 100644
--- a/homeassistant/components/sensor/darksky.py
+++ b/homeassistant/components/sensor/darksky.py
@@ -97,6 +97,20 @@ SENSOR_TYPES = {
['currently', 'hourly', 'daily']],
}
+CONDITION_PICTURES = {
+ 'clear-day': '/static/images/darksky/weather-sunny.svg',
+ 'clear-night': '/static/images/darksky/weather-night.svg',
+ 'rain': '/static/images/darksky/weather-pouring.svg',
+ 'snow': '/static/images/darksky/weather-snowy.svg',
+ 'sleet': '/static/images/darksky/weather-hail.svg',
+ 'wind': '/static/images/darksky/weather-windy.svg',
+ 'fog': '/static/images/darksky/weather-fog.svg',
+ 'cloudy': '/static/images/darksky/weather-cloudy.svg',
+ 'partly-cloudy-day': '/static/images/darksky/weather-partlycloudy.svg',
+ 'partly-cloudy-night': '/static/images/darksky/weather-cloudy.svg',
+}
+
+
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_MONITORED_CONDITIONS):
vol.All(cv.ensure_list, [vol.In(SENSOR_TYPES)]),
@@ -162,6 +176,7 @@ class DarkSkySensor(Entity):
self.type = sensor_type
self.forecast_day = forecast_day
self._state = None
+ self._icon = None
self._unit_of_measurement = None
@property
@@ -188,6 +203,17 @@ class DarkSkySensor(Entity):
"""Return the unit system of this entity."""
return self.forecast_data.unit_system
+ @property
+ def entity_picture(self):
+ """Return the entity picture to use in the frontend, if any."""
+ if self._icon is None or 'summary' not in self.type:
+ return None
+
+ if self._icon in CONDITION_PICTURES:
+ return CONDITION_PICTURES[self._icon]
+ else:
+ return None
+
def update_unit_of_measurement(self):
"""Update units based on unit system."""
unit_index = {
@@ -224,10 +250,12 @@ class DarkSkySensor(Entity):
self.forecast_data.update_minutely()
minutely = self.forecast_data.data_minutely
self._state = getattr(minutely, 'summary', '')
+ self._icon = getattr(minutely, 'icon', '')
elif self.type == 'hourly_summary':
self.forecast_data.update_hourly()
hourly = self.forecast_data.data_hourly
self._state = getattr(hourly, 'summary', '')
+ self._icon = getattr(hourly, 'icon', '')
elif self.forecast_day > 0 or (
self.type in ['daily_summary',
'temperature_min',
@@ -239,6 +267,7 @@ class DarkSkySensor(Entity):
daily = self.forecast_data.data_daily
if self.type == 'daily_summary':
self._state = getattr(daily, 'summary', '')
+ self._icon = getattr(daily, 'icon', '')
else:
if hasattr(daily, 'data'):
self._state = self.get_state(
@@ -262,6 +291,9 @@ class DarkSkySensor(Entity):
if state is None:
return state
+ if 'summary' in self.type:
+ self._icon = getattr(data, 'icon', '')
+
# Some state data needs to be rounded to whole values or converted to
# percentages
if self.type in ['precip_probability', 'cloud_cover', 'humidity']: