From c3984dd2a3f83f066132e99c8b290ffee00a567e Mon Sep 17 00:00:00 2001 From: Meliox Date: Tue, 9 Sep 2025 19:36:47 +0200 Subject: [PATCH] Fix duplicate fan keys --- pve-mod-gui-sensors.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pve-mod-gui-sensors.sh b/pve-mod-gui-sensors.sh index 44e058c..91c6b6d 100644 --- a/pve-mod-gui-sensors.sh +++ b/pve-mod-gui-sensors.sh @@ -406,7 +406,6 @@ collect_sensors_output() { fi #region sensors heredoc sed -i '/my \$dinfo = df('\''\/'\'', 1);/i\ - \ # Collect sensor data from lm-sensors\ $res->{sensorsOutput} = `'"$sensorsCmd"'`;\ \ @@ -425,6 +424,10 @@ collect_sensors_output() { # This prevents JSON key overwrites when multiple SODIMM sensors exist\ # Example: "SODIMM":{"temp3_input":34.0} becomes "SODIMM3":{"temp3_input":34.0}\ $res->{sensorsOutput} =~ s/\\"SODIMM\\":\\{\\"temp(\\d+)_input\\"/\\"SODIMM$1\\":\\{\\"temp$1_input\\"/g;\ + \ + # Fix duplicate fans keys by appending fan number with a space\ + # Example: "Processor Fan":{"fan2_input":1000,...} → "Processor Fan 2":{"fan2_input":1000,...}\ + $res->{sensorsOutput} =~ s/\\"([^"]+)\\":\\{\\"fan(\\d+)_input\\"/\\"$1 $2\\":\{\\"fan$2_input\\"/g;\ ' "$NODES_PM_FILE" #endregion sensors heredoc info "Sensors' retriever added to \"$output_file\"."