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:
1 parent
83cc871edf
commit
aef06a3544
40 files changed
+127
-117
No files matched your search
@@ -130,7 +130,7 @@ class ImapSensor(Entity):
|
||||
try:
|
||||
if await self.connection():
|
||||
await self.refresh_email_count()
|
||||
await self.async_update_ha_state()
|
||||
self.async_write_ha_state()
|
||||
|
||||
idle = await self._connection.idle_start()
|
||||
await self._connection.wait_server_push()
|
||||
@@ -138,7 +138,7 @@ class ImapSensor(Entity):
|
||||
with async_timeout.timeout(10):
|
||||
await idle
|
||||
else:
|
||||
await self.async_update_ha_state()
|
||||
self.async_write_ha_state()
|
||||
except (AioImapException, asyncio.TimeoutError):
|
||||
self.disconnected()
|
||||
|
||||
|
||||
Reference in new issue
Block a user