Fix Build e domenticanza nel routermon

This commit is contained in:
2025-06-01 10:26:11 +02:00
parent 8aad6a6936
commit 0d34d7cb0d
3 changed files with 23 additions and 14 deletions

View File

@@ -43,7 +43,7 @@ def bruteforceCommands(port: serial.Serial):
##################
###### MAIN ######
##################
def main():
def main() -> int:
INTERVAL = int(env['INTERVAL'])
UPS_COMMAND = "Q1"
try:
@@ -55,7 +55,7 @@ def main():
port = serial.Serial(port=env['PORT'], baudrate=int(env['BAUD']), bytesize=8, parity='N', stopbits=1)
except Exception as e:
LOGGER.error(e)
return 0
return 1
finally:
LOGGER.info(f"InfluxDB Connected: [{env['INFLUXDB_URL']}/{env['INFLUXDB_DATABASE']}]")
LOGGER.info(f"Serial Port Open: [{env['PORT']}]")
@@ -82,7 +82,7 @@ def main():
}
LOGGER.debug(f"UPS Status: \n{json.dumps(values, indent=2)}")
if values['onBatt']:
LOGGER.info(f"OnBattery\n{json.dumps(values,indent=2)}")
LOGGER.info(f"OnBattery: \n{json.dumps(values,indent=2)}")
write_client.write(record=dict2Point('ups', values))
time.sleep(INTERVAL)
except Exception as e: