Cleanup and simplitfy the async state update (#9390)
* Cleanup and simplitfy the async state update * Update test_entity.py
This commit is contained in:
parent
c84a099b0f
commit
90f9a6bc0a
47 changed files with 128 additions and 102 deletions
|
@ -72,7 +72,7 @@ class IPWebcamSettingsSwitch(AndroidIPCamEntity, SwitchDevice):
|
|||
else:
|
||||
yield from self._ipcam.change_setting(self._setting, True)
|
||||
self._state = True
|
||||
self.hass.async_add_job(self.async_update_ha_state())
|
||||
self.async_schedule_update_ha_state()
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_turn_off(self, **kwargs):
|
||||
|
@ -86,7 +86,7 @@ class IPWebcamSettingsSwitch(AndroidIPCamEntity, SwitchDevice):
|
|||
else:
|
||||
yield from self._ipcam.change_setting(self._setting, False)
|
||||
self._state = False
|
||||
self.hass.async_add_job(self.async_update_ha_state())
|
||||
self.async_schedule_update_ha_state()
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue