|
19 | 19 |
|
20 | 20 | from roborock.callbacks import CallbackMap |
21 | 21 |
|
| 22 | +from .health_manager import HealthManager |
22 | 23 | from .session import MqttParams, MqttSession, MqttSessionException, MqttSessionUnauthorized |
23 | 24 |
|
24 | 25 | _LOGGER = logging.getLogger(__name__) |
@@ -75,12 +76,18 @@ def __init__( |
75 | 76 | self._connection_task: asyncio.Task[None] | None = None |
76 | 77 | self._topic_idle_timeout = topic_idle_timeout |
77 | 78 | self._idle_timers: dict[str, asyncio.Task[None]] = {} |
| 79 | + self._health_manager = HealthManager(self.restart) |
78 | 80 |
|
79 | 81 | @property |
80 | 82 | def connected(self) -> bool: |
81 | 83 | """True if the session is connected to the broker.""" |
82 | 84 | return self._healthy |
83 | 85 |
|
| 86 | + @property |
| 87 | + def health_manager(self) -> HealthManager: |
| 88 | + """Return the health manager for the session.""" |
| 89 | + return self._health_manager |
| 90 | + |
84 | 91 | async def start(self) -> None: |
85 | 92 | """Start the MQTT session. |
86 | 93 |
|
@@ -337,6 +344,11 @@ def connected(self) -> bool: |
337 | 344 | """True if the session is connected to the broker.""" |
338 | 345 | return self._session.connected |
339 | 346 |
|
| 347 | + @property |
| 348 | + def health_manager(self) -> HealthManager: |
| 349 | + """Return the health manager for the session.""" |
| 350 | + return self._session.health_manager |
| 351 | + |
340 | 352 | async def _maybe_start(self) -> None: |
341 | 353 | """Start the MQTT session if not already started.""" |
342 | 354 | async with self._lock: |
|
0 commit comments