Created
December 23, 2018 18:31
-
-
Save pagenoare/7a38b95371e6e24a00d68394bf132c16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import socket | |
TCP_IP = 'ESP_IP' | |
TCP_PORT = 8080 | |
open_relay = bytes.fromhex('A0 01 00 A1') | |
close_relay = bytes.fromhex('A0 01 01 A2') | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect((TCP_IP, TCP_PORT)) | |
argv = sys.argv[1:] | |
if 'open' in argv: | |
s.send(open_relay) | |
else: | |
s.send(close_relay) | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment