Dashboard fan tile ignores lm-sensors labels and always shows "FAN n"
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 253
- Forks
- 106
- Avg merge
- 6d 22h
- Merged PRs (30d)
- 12
Description
Summary
The Dashboard's fan tile labels fans FAN 1, FAN 2, … from a loop index, and
ignores the labels lm-sensors already provides. A user who has named their fans
in /etc/sensors.d/ sees those names everywhere except the Dashboard.
Where
emhttp/plugins/dynamix/DashStats.page
$fans = exec("sensors -uA 2>/dev/null|grep -c 'fan[0-9]_input'"); // ~line 117
...
$label[$i][] = "<span{$class}>"._('FAN')." ".($fan+1)."</span>"; // ~line 810
The tile only ever obtains a count. The label is synthesised from the index,
so no sensor name can reach it.
Note the two halves behave differently, which is what makes this odd in use:
ignoreworks. Because the count comes fromsensors, ignoring a header
in/etc/sensors.d/correctly removes it from the tile.labeldoes not. The name is discarded.
So a user can successfully hide a fan but cannot name one.
Reproduction
With three of six headers unpopulated, add /etc/sensors.d/example.conf:
chip "nct6798-*"
label fan1 "Rear exhaust"
label fan2 "CPU"
label fan3 "Front cage"
ignore fan4
ignore fan5
ignore fan7
sensors then reports exactly what you'd want:
Rear exhaust: 954 RPM (min = 0 RPM)
CPU: 938 RPM (min = 0 RPM)
Front cage: 266 RPM (min = 0 RPM)
Running the tile's own label loop verbatim against that system:
live fan count from sensors: 3
labels the dashboard renders:
FAN 1
FAN 2
FAN 3
The count correctly dropped from 6 to 3, and all three names were dropped.
Suggested fix
sensors -j already returns JSON keyed by the label, and honours ignore:
"Rear exhaust": { "fan1_input": 954.0, "fan1_min": 0.0, ... },
"CPU": { "fan2_input": 938.0, ... },
"Front cage": { "fan3_input": 266.0, ... }
Taking the display name from that key — and falling back to FAN n when the
key is still the raw sensor name (fan1, fan2, …), i.e. when the user has
not set a label — would use the mechanism lm-sensors already provides, needs no
new configuration or UI, and leaves the default appearance unchanged for
everyone who has not configured labels.
Environment
- Unraid Server OS 7.3.2
- ASUS Pro WS W680-ACE, Nuvoton NCT6798D (
nct6775), 6 fan headers, 3 populated
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in emhttp/plugins/dynamix/DashStats.page at the sensors count near line 117 and the fan label loop near line 810; inspect the sensors -j output and how ignored headers are represented. The work is done when configured lm-sensors labels appear in the Dashboard fan tile, while unlabelled sensors still display FAN n and ignored headers remain absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100