spled / spled.github.io

Apps for LED controller
https://spled.github.io/
11 stars 2 forks source link

SP801E Communication Protocol #28

Open saefty opened 1 year ago

saefty commented 1 year ago

Did anyone manage to read the scenes from the device using the SPE801 WIFI + AP + ST + Artnet controller?

I got pretty far through educated guessing. I also found the TCP response through wireshark that contains the menu visible in the BanlanX App. I would like to read a list of available scenes so I can build a button that iterates through a valid list.

The given code below can set any program id but I have no clue where to the the list of valid ids. They seem to start at 0 but there are some gaps. Maybe because of deleted scenes.

def send_payload(payload):
    # TCP server details
    host = '192.168.178.96'
    port = 8587  # Replace with the appropriate port number

    # Create a TCP socket
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        try:
            # Connect to the server
            s.connect((host, port))

            # Send the payload
            s.sendall(payload)

            # Receive response if needed
            # response = s.recv(1024)
            # Process the response as required

            print("Payload sent successfully.")

        except socket.error as e:
            print(f"Error: {e}")

HEADER = "53505445434800"
SUFFIX = "00000001"

# some random program id
def set_program(varying_part: bytes):
    fixed_bytes = HEADER + "4200" + SUFFIX
    payload = bytes.fromhex(fixed_bytes) + varying_part
    return payload

# values from 1 to 100 binary
def set_brightness(varying_part: bytes):
    fixed_bytes = HEADER + "1500" + SUFFIX
    payload = bytes.fromhex(fixed_bytes) + varying_part
    return payload

# values from 0 to 10 binary
def set_speed(varying_part: bytes):
    fixed_bytes = HEADER + "1600" + SUFFIX
    payload = bytes.fromhex(fixed_bytes) + varying_part
    return payload

if __name__ == "__main__":
    send_payload(set_program(int(2).to_bytes(1, byteorder='big')))
    time.sleep(1)
    send_payload(set_brightness(int(15).to_bytes(1, byteorder='big')))
    time.sleep(1)
    send_payload(set_speed(int(8).to_bytes(1, byteorder='big')))
mit11111 commented 5 months ago

Do you have any success with integration of sk6812 rgbw ?