Merge pull request #1112 from balloob/switch-template

First cut of switch.template
This commit is contained in:
Paulus Schoutsen 2016-02-06 09:12:13 -08:00
commit dde80850a6
3 changed files with 474 additions and 4 deletions

View file

@ -94,10 +94,7 @@ class SensorTemplate(Entity):
def _update_callback(_event):
""" Called when the target device changes state. """
# This can be called before the entity is properly
# initialised, so check before updating state,
if self.entity_id:
self.update_ha_state(True)
self.update_ha_state(True)
self.hass.bus.listen(EVENT_STATE_CHANGED, _update_callback)