Directly call write state 2 (#33513)

* Directly call async_write_ha_state pt2

* Directly call async_write_ha_state pt2

* Fix mock

* Address comments
This commit is contained in:
Paulus Schoutsen
2020-04-03 00:34:50 -07:00
committed by GitHub
parent 83cc871edf
commit aef06a3544
40 changed files with 127 additions and 117 deletions

View File

@@ -36,7 +36,6 @@ from homeassistant.core import (
Context,
HomeAssistant,
callback,
is_callback,
)
from homeassistant.helpers import (
condition,
@@ -679,10 +678,7 @@ class Script:
def _changed(self):
if self.change_listener:
if is_callback(self.change_listener):
self.change_listener()
else:
self._hass.async_add_job(self.change_listener)
self._hass.async_run_job(self.change_listener)
@property
def is_running(self) -> bool: