cose non cose
This commit is contained in:
@@ -74,6 +74,7 @@ def main() -> int:
|
|||||||
###### END MAIN LOOP #########
|
###### END MAIN LOOP #########
|
||||||
##############################
|
##############################
|
||||||
connection.disconnect()
|
connection.disconnect()
|
||||||
|
write_client.close()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -4,11 +4,10 @@ import time
|
|||||||
import serial
|
import serial
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
from pyutils.utils import *
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
from pyutils.utils import *
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from influxdb_client_3 import InfluxDBClient3
|
from influxdb_client_3 import InfluxDBClient3, WriteOptions
|
||||||
|
|
||||||
# Get environment variables
|
# Get environment variables
|
||||||
env = dict(os.environ)
|
env = dict(os.environ)
|
||||||
@@ -78,7 +77,7 @@ class UPSbattery(UPScommand):
|
|||||||
data = self.request(port=port, cmd="QBV")
|
data = self.request(port=port, cmd="QBV")
|
||||||
self.battV = float(data[0])
|
self.battV = float(data[0])
|
||||||
self.battPct = int(data[3])
|
self.battPct = int(data[3])
|
||||||
self.timeLeft = round(int(data[4]) / 60.0, 2)
|
self.timeLeft = round(int(data[4]) / 60.0, 1)
|
||||||
|
|
||||||
##################
|
##################
|
||||||
###### MAIN ######
|
###### MAIN ######
|
||||||
@@ -141,6 +140,7 @@ def main() -> int:
|
|||||||
###### END MAIN LOOP #########
|
###### END MAIN LOOP #########
|
||||||
##############################
|
##############################
|
||||||
port.close()
|
port.close()
|
||||||
|
write_client.close()
|
||||||
LOGGER.warning("Main thread exited normally")
|
LOGGER.warning("Main thread exited normally")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user