Merge pull request #1112 from balloob/switch-template
First cut of switch.template
This commit is contained in:
commit
dde80850a6
3 changed files with 474 additions and 4 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue