|
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__) |
@@ -74,12 +75,18 @@ def __init__( |
74 | 75 | self._connection_task: asyncio.Task[None] | None = None |
75 | 76 | self._topic_idle_timeout = topic_idle_timeout |
76 | 77 | self._idle_timers: dict[str, asyncio.Task[None]] = {} |
| 78 | + self._health_manager = HealthManager(self.restart) |
77 | 79 |
|
78 | 80 | @property |
79 | 81 | def connected(self) -> bool: |
80 | 82 | """True if the session is connected to the broker.""" |
81 | 83 | return self._healthy |
82 | 84 |
|
| 85 | + @property |
| 86 | + def health_manager(self) -> HealthManager: |
| 87 | + """Return the health manager for the session.""" |
| 88 | + return self._health_manager |
| 89 | + |
83 | 90 | async def start(self) -> None: |
84 | 91 | """Start the MQTT session. |
85 | 92 |
|
@@ -323,6 +330,11 @@ def connected(self) -> bool: |
323 | 330 | """True if the session is connected to the broker.""" |
324 | 331 | return self._session.connected |
325 | 332 |
|
| 333 | + @property |
| 334 | + def health_manager(self) -> HealthManager: |
| 335 | + """Return the health manager for the session.""" |
| 336 | + return self._session.health_manager |
| 337 | + |
326 | 338 | async def _maybe_start(self) -> None: |
327 | 339 | """Start the MQTT session if not already started.""" |
328 | 340 | async with self._lock: |
|
0 commit comments