27 lines
1021 B
Python
Executable File
27 lines
1021 B
Python
Executable File
#!python
|
|
import aiohttp
|
|
import asyncio
|
|
from matter_server.client import MatterClient
|
|
from matter_server.client.models.node import MatterNode
|
|
from matter_server.common.models import MatterNodeData
|
|
|
|
async def commissionner(ws_server_url):
|
|
# Créer une session aiohttp
|
|
async with aiohttp.ClientSession() as session:
|
|
# Initialiser le client Matter avec la session aiohttp
|
|
async with MatterClient(ws_server_url, session) as client:
|
|
# client = MatterClient(ws_server_url, session)
|
|
# client.connect()
|
|
|
|
try:
|
|
mnd:MatterNodeData = await client.commission_with_code("16489714152", True) # TODO coroutine car sinon ne rend pas la main
|
|
print("ICI !!!!!!!!!!!!!!!!!!!!!!")
|
|
except Exception as e:
|
|
print(f"Erreur lors de la récupération des appareils: {e}")
|
|
|
|
# Remplacez par l'adresse IP de votre python-matter-server
|
|
ws_server_url = "ws://localhost:5580/ws"
|
|
|
|
# Exécuter la fonction asynchrone
|
|
asyncio.run(commissionner(ws_server_url))
|