Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/argononed.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ def temp_check():
prevspeed=0
while True:
val = argonsysinfo_gettemp()
hddval = argonsysinfo_gethddtemp()
if hddval > val:
val = hddval
newspeed = get_fanspeed(val, fanconfig)
if newspeed < prevspeed:
# Pause 30s if reduce to prevent fluctuations
Expand Down
17 changes: 16 additions & 1 deletion src/argonsysinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import time
import socket
import subprocess

def argonsysinfo_listcpuusage(sleepsec = 1):
outputlist = []
Expand Down Expand Up @@ -152,6 +153,20 @@ def argonsysinfo_getip():
st.close()
return ipaddr

def argonsysinfo_gethddtemp():
hddtemp = 0
storedhddtemp = 0
try:
for disk in os.listdir("/dev/disk/by-id"):
if disk.startswith("ata"):
f = "sata:" + os.path.join("/dev/disk/by-id", disk)
process = subprocess.Popen(["/usr/sbin/hddtemp", "-n", f], shell=False, stdout=subprocess.PIPE)
hddtemp = int(process.communicate()[0])
if hddtemp > storedhddtemp:
storedhddtemp = hddtemp
return float(storedhddtemp)
except:
return 0

def argonsysinfo_getrootdev():
tmp = os.popen('mount').read()
Expand Down Expand Up @@ -325,4 +340,4 @@ def argonsysinfo_getraiddetail(devname):
failed = infolist[1]
elif infolist[0].lower() == "spare devices":
spare = infolist[1]
return {"state": state, "raidtype": raidtype, "size": int(size), "used": int(used), "devices": int(total), "active": int(active), "working": int(working), "failed": int(failed), "spare": int(spare)}
return {"state": state, "raidtype": raidtype, "size": int(size), "used": int(used), "devices": int(total), "active": int(active), "working": int(working), "failed": int(failed), "spare": int(spare)}
2 changes: 1 addition & 1 deletion tutorials/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ argon_check_pkg() {
fi
}

pkglist=(raspi-gpio python-rpi.gpio python3-rpi.gpio python-smbus python3-smbus i2c-tools)
pkglist=(raspi-gpio python-rpi.gpio python3-rpi.gpio python-smbus python3-smbus i2c-tools hddtemp)
for curpkg in ${pkglist[@]}; do
sudo apt-get install -y $curpkg
RESULT=$(argon_check_pkg "$curpkg")
Expand Down