BLU 100 controlled by Python
jake_watt258_
Posts: 2
I am trying to gain control of a Blu 100 with python I seem to have gotten it to no longer throw out errors however I am struggling to get the string correct, I have tested with RS-232 and that seems to be of a fan of HEX without any Prefix or separator, here is the code I've used so far
import socket
TCP_IP = '192.250.1.95'
TCP_PORT = 1023
BUFFER_SIZE = 1024
MESSAGE = "02,88,6A,39,1B,82,00,00,1B,82,00,01,00,00,00,00,DA,03"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
str (MESSAGE)
data = s.recv(BUFFER_SIZE)
s.close()
Please let me know if I've over looked a setting or if part of the code is wrong
0
Comments
I have found a Python script that works now here is the code if anyone else is struggling
import socket
import sys
import struct
import time
import binascii
host = '10.250.1.95'
port = 1023
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
#Use HEX without any prefix or Separator
inputHex = binascii.unhexlify("02886A391B8200001B82000100000001DB03")
try:
#remote_ip = socket.gethostbyname(host)
s.connect((host, port))
except socket.gaierror:
print('Hostname could not be resolved Exiting')
sys.exit()
print('Socket connected to ' + host + ' on ip ')
try:
while True:
s.send(inputHex)
print('Message sent Successfully')
time.sleep(1)
print('sending')
except socket.error:
print('send fail')
sys.exit()