|
14 | 14 | from typing import Any, Literal, Optional |
15 | 15 |
|
16 | 16 | import aiohttp |
17 | | -from aiohttp import ClientResponse, ClientResponseError, RequestInfo, WebSocketError, WSMsgType |
| 17 | +from aiohttp import ClientResponseError, WebSocketError, WSMsgType |
18 | 18 | from pydantic import BaseModel |
19 | 19 |
|
20 | 20 | import appdaemon.utils as utils |
@@ -134,7 +134,7 @@ def create_session(self) -> aiohttp.ClientSession: |
134 | 134 | timeout=aiohttp.ClientTimeout( |
135 | 135 | connect=connect_timeout_secs, |
136 | 136 | sock_connect=connect_timeout_secs, |
137 | | - ) |
| 137 | + ), |
138 | 138 | ) |
139 | 139 |
|
140 | 140 | async def websocket_msg_factory(self) -> AsyncGenerator[aiohttp.WSMessage]: |
@@ -233,14 +233,8 @@ async def __post_auth__(self) -> None: |
233 | 233 | case _: |
234 | 234 | raise HAEventsSubError(-1, f"Unknown response from subscribe_events: {res}") |
235 | 235 |
|
236 | | - self._create_maintenance_task( |
237 | | - self.looped_coro(self.get_hass_config, self.config.config_sleep_time.total_seconds()), |
238 | | - name="get_hass_config loop" |
239 | | - ) |
240 | | - self._create_maintenance_task( |
241 | | - self.looped_coro(self.get_hass_services, self.config.services_sleep_time.total_seconds()), |
242 | | - name="get_hass_services loop" |
243 | | - ) |
| 236 | + self._create_maintenance_task(self.looped_coro(self.get_hass_config, self.config.config_sleep_time.total_seconds()), name="get_hass_config loop") |
| 237 | + self._create_maintenance_task(self.looped_coro(self.get_hass_services, self.config.services_sleep_time.total_seconds()), name="get_hass_services loop") |
244 | 238 |
|
245 | 239 | if self.first_time: |
246 | 240 | conditions = self.config.appdaemon_startup_conditions |
@@ -549,10 +543,7 @@ async def wait_for_conditions(self, conditions: StartupConditions | None) -> Non |
549 | 543 |
|
550 | 544 | if delay := conditions.delay: |
551 | 545 | self.logger.info(f"Adding a {delay:.0f}s delay to the {self.name} startup") |
552 | | - task = self._create_maintenance_task( |
553 | | - self.AD.utility.sleep(delay, timeout_ok=True), |
554 | | - name="startup delay" |
555 | | - ) |
| 546 | + task = self._create_maintenance_task(self.AD.utility.sleep(delay, timeout_ok=True), name="startup delay") |
556 | 547 | tasks.append(task) |
557 | 548 |
|
558 | 549 | self.logger.info(f"Waiting for {len(tasks)} startup condition tasks after {self.time_str()}") |
@@ -907,7 +898,7 @@ async def get_plugin_state( |
907 | 898 | match resp: |
908 | 899 | case ClientResponseError(message=str(msg)): |
909 | 900 | self.logger.error("Error getting state: %s", msg) |
910 | | - case (dict() | None): |
| 901 | + case dict() | None: |
911 | 902 | return resp |
912 | 903 | case _: |
913 | 904 | raise ValueError(f"Unexpected result from get_plugin_state: {resp}") |
|
0 commit comments