Prove upsmon
This commit is contained in:
16
upsmon/ups.py
Normal file
16
upsmon/ups.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import string
|
||||
import serial
|
||||
import time
|
||||
|
||||
port = serial.Serial(port='COM3', baudrate=2400, bytesize=8, parity='N', stopbits=1)
|
||||
|
||||
for c in string.ascii_uppercase:
|
||||
for n in range(100):
|
||||
d = c+f"{n:02d}"
|
||||
port.write((d+chr(13)).encode())
|
||||
port.flush()
|
||||
r = port.read_all().decode('ascii').rstrip()
|
||||
print(f"{d} : {r}", sep='^H')
|
||||
if 'NAK' not in r:
|
||||
print()
|
||||
time.sleep(0.1)
|
||||
Reference in New Issue
Block a user