Compare commits

..

2 Commits

Author SHA1 Message Date
13c419353c fix str conversion to float 2025-12-22 15:34:11 +01:00
3d6e77a9e7 added service restart and new keys to export 2025-12-22 13:31:49 +01:00
2 changed files with 3 additions and 3 deletions

View File

@@ -9,5 +9,5 @@ sudo cp upsmon.service /etc/systemd/system/upsmon.service
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable upsmon.service
sudo systemctl start upsmon.service
sudo systemctl restart upsmon.service

View File

@@ -29,11 +29,11 @@ CMD: list[str] = ['apcaccess', '-u']
T_LONG: float = 15.0
T_SHORT: float = 5.0
EXPORT_KEYS: list[str] = [
'UPSNAME', 'STATUS', 'LINEV', 'LOADPCT', 'BCHARGE', 'TIMELEFT', 'ITEMP', 'BATTV', 'LINEFREQ'
'UPSNAME', 'STATUS', 'LINEV', 'LOADPCT', 'BCHARGE', 'TIMELEFT', 'ITEMP', 'BATTV', 'LINEFREQ', 'TONBATT', 'CUMONBATT', 'NUMXFERS'
]
def clean_data(v: str) -> float | str:
if v.isalpha():
if v.replace(" ","").isalpha():
return v
return float(v)