Fix Build e domenticanza nel routermon
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user