Compare commits

..

No commits in common. "fde5d705ccacdbef4544c993e75ff642574ce139" and "d0bb1735189003284eb32310f912bd29c59cef70" have entirely different histories.

3 changed files with 4 additions and 15 deletions

View File

@ -123,7 +123,6 @@ def shutdown_nas():
stdin, stdout, stderr = client.exec_command('sudo shutdown') stdin, stdout, stderr = client.exec_command('sudo shutdown')
for line in stdout: for line in stdout:
print(line.strip()) print(line.strip())
client.close()
except Exception as e: except Exception as e:
logger.error(e) logger.error(e)
@ -149,7 +148,7 @@ def pwr_online(battery):
logger.info(message) logger.info(message)
send_email(f"{ups_id}: Power On Line", message) send_email(f"{ups_id}: Power On Line", message)
send_discord(message) send_discord(message)
if ups_id == "Server" and battery > 75: if ups_id == "Server" and battery > 90:
wake_up(battery) wake_up(battery)
def pwr_offline(battery): def pwr_offline(battery):
@ -172,8 +171,8 @@ def batt_crit(battery):
if ups_id == "Server": if ups_id == "Server":
for node in servers: for node in servers:
shutdown_pve(node) shutdown_pve(node)
time.sleep(120)
shutdown_nas() shutdown_nas()
time.sleep(300)
# Main Loop # Main Loop
def main(): def main():
@ -192,8 +191,8 @@ def main():
else: else:
logger.info(f"UPS status changed to: {status}") logger.info(f"UPS status changed to: {status}")
prev_status = status prev_status = status
elif status == "OB DISCHRG" and battery < 70: elif status == "OB DISCHRG" and battery < 50:
if battery < 65: if battery < 25:
batt_crit(battery) batt_crit(battery)
if ups_id == "Server": if ups_id == "Server":
for node in servers: for node in servers:

View File

@ -3,6 +3,5 @@ ping3
config config
discord discord
paramiko paramiko
requests
proxmoxer proxmoxer
wakeonlan wakeonlan

View File

@ -1,9 +0,0 @@
import sys
import time
with open('/dev/hidg0', 'wb') as f:
f.write(b'\x01')
time.sleep(0.3)
f.write(b'\x00')
sys.exit()