Compare commits
No commits in common. "fde5d705ccacdbef4544c993e75ff642574ce139" and "d0bb1735189003284eb32310f912bd29c59cef70" have entirely different histories.
fde5d705cc
...
d0bb173518
9
power.py
9
power.py
@ -123,7 +123,6 @@ def shutdown_nas():
|
||||
stdin, stdout, stderr = client.exec_command('sudo shutdown')
|
||||
for line in stdout:
|
||||
print(line.strip())
|
||||
client.close()
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
@ -149,7 +148,7 @@ def pwr_online(battery):
|
||||
logger.info(message)
|
||||
send_email(f"{ups_id}: Power On Line", message)
|
||||
send_discord(message)
|
||||
if ups_id == "Server" and battery > 75:
|
||||
if ups_id == "Server" and battery > 90:
|
||||
wake_up(battery)
|
||||
|
||||
def pwr_offline(battery):
|
||||
@ -172,8 +171,8 @@ def batt_crit(battery):
|
||||
if ups_id == "Server":
|
||||
for node in servers:
|
||||
shutdown_pve(node)
|
||||
time.sleep(120)
|
||||
shutdown_nas()
|
||||
time.sleep(300)
|
||||
|
||||
# Main Loop
|
||||
def main():
|
||||
@ -192,8 +191,8 @@ def main():
|
||||
else:
|
||||
logger.info(f"UPS status changed to: {status}")
|
||||
prev_status = status
|
||||
elif status == "OB DISCHRG" and battery < 70:
|
||||
if battery < 65:
|
||||
elif status == "OB DISCHRG" and battery < 50:
|
||||
if battery < 25:
|
||||
batt_crit(battery)
|
||||
if ups_id == "Server":
|
||||
for node in servers:
|
||||
|
@ -3,6 +3,5 @@ ping3
|
||||
config
|
||||
discord
|
||||
paramiko
|
||||
requests
|
||||
proxmoxer
|
||||
wakeonlan
|
@ -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()
|
Loading…
Reference in New Issue
Block a user