Prove upsmon

This commit is contained in:
Emanuele Trabattoni
2025-05-30 10:19:36 +02:00
parent a6d3d21585
commit 6cac8b8c90
5 changed files with 25 additions and 88 deletions

16
upsmon/ups.py Normal file
View 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)