Skip to content

dedup and add all drives scan - #2

Open
cvanelteren wants to merge 28 commits into
Rocketplanner83:mainfrom
cvanelteren:dedup-and-scan-all
Open

dedup and add all drives scan#2
cvanelteren wants to merge 28 commits into
Rocketplanner83:mainfrom
cvanelteren:dedup-and-scan-all

Conversation

@cvanelteren

Copy link
Copy Markdown

Hi there thanks for the initiative. I would love to add more functionality with regards to letting the fan curve be determined based on the drive temps. I dedupped the logic and extended the drive scanning.

Rocketplanner83 and others added 24 commits July 11, 2025 20:30
truefan is a lightweight, web-based fan controller built for Linux systems running lm-sensors. It provides a simple and responsive interface to monitor fan speeds and CPU temperatures, manually apply fan profiles, or restart the system directly from the browser. Built with Flask, it's easy to deploy via Docker or Docker Compose and integrates seamlessly with Dockge, Portainer, and bare-metal setups.

Ideal for home labs, servers, or TrueNAS SCALE boxes with custom fan configurations, truefan helps you keep temperatures under control with style.
Updated with a dockge button
Comment thread app/fan.py Outdated
return int(float(line.split()[3].replace("+", "").replace("°C", "")))
except:
return 0
scan_out = subprocess.check_output(["smartctl", "--scan"], encoding="utf-8")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw smartclt can output json...

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but scanning disks every time is not great, should happen only one time per container startup. I dont think disks change so often...

Also it seems that this file is called run via subprocess in server.py. Why not just import the funcs and call directly?

@Rocketplanner83

Copy link
Copy Markdown
Owner

Thanks for the thoughtful review — all good points.

Regarding smartctl JSON output: agreed. Switching to JSON parsing instead of string splitting is the right move. It will make the temperature parsing more reliable and future-proof against formatting changes. I’ll update the implementation to use smartctl -j and parse the JSON payload instead of relying on positional splits.

On disk scanning frequency: you’re absolutely right. Scanning on every request is unnecessary and inefficient. I’ll refactor this so disk enumeration happens once at container startup and is cached, with periodic refresh only if needed. That will reduce overhead and keep runtime behavior predictable.

As for calling via subprocess from server.py: good catch. That’s legacy from an earlier structure. Refactoring to import the functions directly and call them natively will be cleaner and avoids unnecessary process spawning. I’ll consolidate that to keep everything in-process.

Appreciate the detailed feedback — this improves both performance and maintainability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants