From d57df2dddea47c47b864e70942df3bd90c956898 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 18 Feb 2016 17:59:58 -0800 Subject: [PATCH] Update the sensor classes in the demo binary_sensor This updates the two demo sensors we have so they show contextual icons in the UI. --- homeassistant/components/binary_sensor/demo.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/binary_sensor/demo.py b/homeassistant/components/binary_sensor/demo.py index 087d7405d9b..90c7accf512 100644 --- a/homeassistant/components/binary_sensor/demo.py +++ b/homeassistant/components/binary_sensor/demo.py @@ -9,17 +9,23 @@ from homeassistant.components.binary_sensor import BinarySensorDevice def setup_platform(hass, config, add_devices, discovery_info=None): """ Sets up the Demo binary sensors. """ add_devices([ - DemoBinarySensor('Basement Floor Wet', False), - DemoBinarySensor('Movement Backyard', True), + DemoBinarySensor('Basement Floor Wet', False, 'moisture'), + DemoBinarySensor('Movement Backyard', True, 'motion'), ]) class DemoBinarySensor(BinarySensorDevice): """ A Demo binary sensor. """ - def __init__(self, name, state): + def __init__(self, name, state, sensor_class): self._name = name self._state = state + self._sensor_type = sensor_class + + @property + def sensor_class(self): + """ Return our class. """ + return self._sensor_type @property def should_poll(self):