Use async_write_ha_state within async methods

This commit is contained in:
Michael "Chishm" Chisholm
2021-10-01 14:09:25 +10:00
parent 3f6be69f03
commit 899db1c355

View File

@@ -256,7 +256,7 @@ class DlnaDmrEntity(MediaPlayerEntity):
)
# Device could have been de/re-connected, state probably changed
self.schedule_update_ha_state()
self.async_write_ha_state()
async def async_config_update_listener(
self, hass: HomeAssistant, entry: config_entries.ConfigEntry
@@ -293,7 +293,7 @@ class DlnaDmrEntity(MediaPlayerEntity):
_LOGGER.warning("Couldn't (re)connect after config change: %r", err)
# Device was de/re-connected, state might have changed
self.schedule_update_ha_state()
self.async_write_ha_state()
async def _device_connect(self, location: str) -> None:
"""Connect to the device now that it's available."""