matter/onOff.py
2025-05-27 16:58:58 +02:00

20 lines
670 B
Python
Executable File

#!python
from matter_server.client import MatterClient
def turn_on_shelly_via_matter_client(server_ip, device_id):
# Initialiser le client Matter
client = MatterClient(server_ip)
try:
# Envoyer la commande pour allumer l'appareil
response = client.send_command(device_id, "on")
print("Shelly Switch allumé avec succès via matter_server.client.")
except Exception as e:
print(f"Erreur lors de l'allumage du Shelly Switch: {e}")
# Remplacez par l'adresse IP de votre python-matter-server et l'ID de l'appareil
server_ip = "localhost"
device_id = "your_device_id"
turn_on_shelly_via_matter_client(server_ip, device_id)