api: connect to CCUJACK MQTT broker on startup
All checks were successful
Build Container / Build Container (push) Successful in 1m29s
All checks were successful
Build Container / Build Container (push) Successful in 1m29s
This commit is contained in:
parent
1a50d67df6
commit
0331dd6406
3 changed files with 17 additions and 2 deletions
|
|
@ -4,6 +4,8 @@ import logging
|
|||
import asyncio
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from dooris_api.mqtt_client import AsyncMqttClient
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -69,7 +71,7 @@ class CCUJackClient:
|
|||
base_uri: str
|
||||
locks: LockData
|
||||
|
||||
def __init__(self, base_uri: str, auth: BasicAuth):
|
||||
def __init__(self, base_uri: str, auth: BasicAuth, mqtt_conn: str):
|
||||
self.http = ClientSession(
|
||||
base_url=base_uri,
|
||||
auth=auth,
|
||||
|
|
@ -77,6 +79,10 @@ class CCUJackClient:
|
|||
connector=TCPConnector(ssl=False),
|
||||
)
|
||||
self.locks = None
|
||||
self.mqtt = AsyncMqttClient(mqtt_conn, auth.login, auth.password)
|
||||
|
||||
async def connect_mqtt(self):
|
||||
await self.mqtt.connect()
|
||||
|
||||
async def find_locks(self):
|
||||
logger.debug("Inspecting lock devices present in CCUJack")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue