2025-04-27 19:45:45 +02:00

37 lines
1.0 KiB
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script pour basculer l'état de la caméra (activé/désactivé)
À utiliser avec StreamDeck
"""
import sys
import os
# Ajouter le répertoire parent au path pour les imports
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from common.utils import connect_device, toggle_device, report_for_streamdeck
# ID et nom de l'appareil
DEVICE_ID = "bf584a5db6d2208dcf2bol"
DEVICE_NAME = "Cam-Dino"
# Pour cette caméra, le commutateur principal est sur le DPS 101
SWITCH_ID = "101"
def main():
"""Fonction principale pour basculer l'état de la caméra"""
# Connexion à l'appareil
device = connect_device(DEVICE_ID)
if not device:
report_for_streamdeck(False, DEVICE_NAME)
return
# Basculer l'état et obtenir le nouvel état
new_state = toggle_device(device, SWITCH_ID)
# Rapport pour StreamDeck
report_for_streamdeck(new_state is not None, DEVICE_NAME, new_state)
if __name__ == "__main__":
main()