mirror of
https://github.com/home-assistant/core.git
synced 2025-11-12 04:20:17 +00:00
Simplify track_same_state (#9795)
This commit is contained in:
committed by
Pascal Vizeli
parent
fc47e9443b
commit
a97e7bb22d
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user