Simplify track_same_state (#9795)

This commit is contained in:
Paulus Schoutsen authored and Pascal Vizeli committed 2017-10-10 21:16:19 +02:00
1 parent fc47e9443b
commit a97e7bb22d
5 files changed
+23 -23

No files matched your search

@@ -135,7 +135,7 @@ class BinarySensorTemplate(BinarySensorDevice):
return False
@callback
def _async_render(self, *args):
def _async_render(self):
"""Get the state of template."""
try:
return self._template.async_render().lower() == 'true'
@@ -171,5 +171,5 @@ class BinarySensorTemplate(BinarySensorDevice):
period = self._delay_on if state else self._delay_off
async_track_same_state(
self.hass, state, period, set_state, entity_ids=self._entities,
async_check_func=self._async_render)
self.hass, period, set_state, entity_ids=self._entities,
async_check_same_func=lambda *args: self._async_render() == state)