fix check if session has state connected
This commit is contained in:
parent
2f7c7e1aa8
commit
fccca0919a
1 changed files with 6 additions and 3 deletions
|
|
@ -5,6 +5,8 @@ import uuid
|
|||
from datetime import datetime, timedelta
|
||||
from typing import Any
|
||||
|
||||
from amqtt.session import Session
|
||||
|
||||
import bumper
|
||||
|
||||
|
||||
|
|
@ -154,9 +156,10 @@ def include_EcoVacsHomeProducts_info(bot) -> dict[str, Any]:
|
|||
)
|
||||
|
||||
# mqtt_connection is not always set correctly, therefore workaround until fixed properly
|
||||
for session in bumper.mqtt_server.broker._sessions:
|
||||
did = session.split("@")[0]
|
||||
if did == bot["did"]:
|
||||
session: Session
|
||||
for (session, _) in bumper.mqtt_server.broker._sessions.values():
|
||||
did = session.client_id.split("@")[0]
|
||||
if did == bot["did"] and session.transitions.state == "connected":
|
||||
result["status"] = 1
|
||||
|
||||
return result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue