Update blind
This commit is contained in:
parent
e6d03d3703
commit
95e500540a
22
blind
22
blind
|
@ -4,16 +4,19 @@ import sys
|
|||
import json
|
||||
import socket
|
||||
|
||||
# The code is not fancy or elegant, but it works.
|
||||
#
|
||||
# Paul McGowan 2021
|
||||
|
||||
|
||||
#
|
||||
# Add the names of your blinds here together with
|
||||
# the IP address of your bridge.
|
||||
# Add the mac adress and AccessCode to the 'payload'
|
||||
# the IP adress of your bridge, your token and mac
|
||||
# address of your bridge.
|
||||
#
|
||||
# The code is not elegant, but it works and provides a
|
||||
# starting point.
|
||||
|
||||
blinds = ["dining","patio","bedroom","study","ella"]
|
||||
server = ("10.10.255.66", 32100)
|
||||
server = ("+++Bridge IP", 32100)
|
||||
token = "+++TOKEN+++"
|
||||
mac = "+++mac address+++"
|
||||
|
||||
def sanityCheck():
|
||||
if blind == "0000":
|
||||
|
@ -58,9 +61,9 @@ for x in blinds:
|
|||
sanityCheck()
|
||||
|
||||
Payload = str.encode('{"msgType":"WriteDevice",\
|
||||
"mac":"--MAC--'+blind+'",\
|
||||
"mac":"'+mac+''+blind+'",\
|
||||
"DeviceType":"10000000",\
|
||||
"AccessToken":"--TOKEN--",\
|
||||
"AccessToken":"'+token+'",\
|
||||
"msgID":"21200331105735705",\
|
||||
"data":{"'+data+'":'+operation+'}\
|
||||
}')
|
||||
|
@ -69,3 +72,4 @@ UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
|
|||
UDPClientSocket.sendto(Payload, server)
|
||||
response = UDPClientSocket.recvfrom(buffer)
|
||||
print(json.dumps(json.loads(format(response[0])), indent=4, sort_keys=True))
|
||||
|
||||
|
|
Loading…
Reference in New Issue