Hi, in my house i have a domotica controller, i can send TCP commands to it to turn all my lights/switches on off, all is working perfectly , i have configured all templates lights/switches, that use a shell command…
i have also exposed my lights/switches to google assistant, all was working fine , untill this new improvement came :
before that PR: basicly what happened, is when you say to google like, turn all lights on , it sends the all commands in a sequence, so my light was turned on, one by one … no problem
After that PR/ when you say, turn all lights ON, HA just sends ON commands all together, and not in sequence anymore… my controller is not able to handle multiple requests together …
so i am tryng to write a code, like below, with some copy/paste stuff from google, but i cant figure it out, something is not right, with that try except stuff
the code is working though, when i turn 1 light on / off, but when turn on like 4 lights, only 2 are turned ON
how can i make this to work?
or is there maybe another way to accomplish what i want todo ?
tnx and appreciated
#!/usr/bin/python3 import socket import time import binascii import sys host = '192.168.0.10' port = 1001 message = binascii.a2b_hex ("ED43310000000000000000000000AFAF" + sys.argv.zfill(2) + sys.argv.zfill(2) + sys.argv.zfill(2)) # First try-except block -- create socket try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) except socket.error: print ("Error creating socket") sys.exit(1) # Second try-except block -- connect to given host/port try: s.connect((host, port)) except socket.gaierror: print ("Address-related error connecting to server") s.connect((host, port)) except socket.error: print ("Connection error") s.connect((host, port)) except socket.timeout: print ("Connection timeout socket connect") s.connect((host, port)) # Third try-except block -- sending data try: s.send(message) except socket.error: print("Error sending data") s.send(message) except socket.timeout: print ("Connection timeout send message") s.connect((host, port)) s.close() '''