Bonjour !

Je suis nouveau sur ce forum, et j'espère que mon inexpérience ne vous fera pas peur.
Voila mon problème : Je travaille pour un intégrateur, et nous avons à intégrer un contrôleur led wifi zengge dans une interface intuilab.
Après avoir cherché dans github comme un fou, j'ai trouvé des scripts compilable sous lango, mais incomplets.
ET... J'ai trouvé un script python qui fonctionne parfaitement, mais lors de son exécution sous windows 10 ( avec python ), la fenêtre python/interprétée par win 10 m'offre un sympathique menu qui m'offre un choix multiple.
Or, j'ai besoin pour mon intégration de lancer l'un de ces choix automatiquement.
C'est là que j'ai besoin de vous, comment print un choix automatiquement, sachant que je peux créer autant de fichiers avec le même script, mais avec des choix différents.
Ensuite et ce sera tout, je voudrais, une fois le script terminé, fermer cette fenêtre.
Je vous copie le code, si vous avez des idées, je vous remercie d'avance !

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
!/usr/bin/env python
import socket
 
 
 
 
ip = "192.168.0.16"
port = 5577
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((ip, port))
 
 
commands = {
        "on":  bytearray([0x71, 0x23, 0x0F]),
        "off": bytearray([0x71, 0x22, 0x0F]),
        "warm": bytearray([0x31, 0x00, 0x00, 0x00, 0xFF, 0x0F, 0x0F]),
        "warmw": bytearray([0x31, 0x00, 0x00, 0x00, 0xFF, 0x34, 0x0F]),
        "white": bytearray([0x31, 0xFF, 0x00, 0x00, 0xFF, 0xF0, 0x0F]),
           "down": bytearray([0x31, 0x00, 0x00, 0x00, 0xFF, 0x34, 0x0F]),
    "up": bytearray([0x31, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x0F])
        }
 
 
 
 
def run():
    print("List of commands:")
    for key, value in commands.items():
        print(key)
 
    while True:
        c = input("Command: ")
        if c not in commands:
            print("List of commands:")
            for key, value in commands.items():
                print(key)
 
        else:
            send(commands.get(c))
 
 
def checksum(command):
    checksum = sum(command) & 0xFF
    command.append(checksum)
    return command
 
 
def send(command):
    command = checksum(command)
    sock.send(command)
 
 
def finish():
    sock.close()
 
 
 
 
if __name__ == "__main__":
    run()


[SIZE=3]