Skip to content

FanAddon.update_config does not apply patch to self.config, so gpio_fan_led config can be ignored #3

@wjdevans77

Description

@wjdevans77

SunFounder pm_auto FanAddon config update bug report draft

Summary

pm_auto 1.4.7 FanAddon.update_config() builds and returns a patch dictionary from user configuration, but unlike similar addons such as OLEDAddon, it does not apply that patch back to self.config before returning.

On Pironman 5 Max, this means settings such as gpio_fan_led: "off" can be present in /opt/pironman5/config.json but ignored at runtime during FanAddon.__init__(), because self.config still contains DEFAULT_CONFIG values like gpio_fan_led: "follow".

Affected version

Observed with:

  • pironman5 1.3.7
  • pm_auto 1.4.7
  • Pironman 5 Max variant
  • Raspberry Pi 5 / Raspberry Pi OS

Hardware context

Pironman 5 Max uses separate GPIO-controlled lanes for case fans and fan LEDs:

  • BCM GPIO6: case fan motor power gate
  • BCM GPIO5: case fan LED power/control gate

Desired user config:

{
  "gpio_fan_mode": 0,
  "gpio_fan_led": "off",
  "gpio_fan_pin": 6,
  "gpio_fan_led_pin": 5
}

Expected behavior:

  • Case fans remain on because gpio_fan_mode: 0 means Always On.
  • Fan LEDs remain off because gpio_fan_led: "off".

Actual behavior before patch:

  • Case fans run.
  • Fan LEDs turn on/follow fan state anyway.
  • Runtime behavior matches default gpio_fan_led: "follow", not configured "off".

Root cause

In pm_auto/addons/fan.py, FanAddon.update_config() accumulates valid keys in patch and returns it, but never calls:

self.config.update(patch)

That means later code using self.config[...] sees stale defaults.

In particular, FanAddon.__init__() does:

self.gpio_fan.set_led(self.config["gpio_fan_led"])

but self.config["gpio_fan_led"] can still be the default value ("follow") even when config passed into the addon contains "off".

OLEDAddon.update_config() in the same package appears to use the expected pattern:

self.config.update(patch)
return patch

Minimal fix

Add one line immediately before return patch in FanAddon.update_config():

self.config.update(patch)
return patch

Verified result

After applying the one-line patch and restarting pironman5.service:

  • gpio_fan_led: "off" is honored.
  • /sys/kernel/debug/gpio shows GPIO5 low while GPIO6 remains high.
  • Case fans run continuously.
  • Case fan LEDs stay dark.

Example observed GPIO state:

gpio-574 (GPIO5 |lg) out lo   # fan LEDs off
gpio-575 (GPIO6 |lg) out hi   # fan motors on

Notes

This bug is easy to confuse with a hardware limitation because the Pironman 5 Max fan LED lane is not RGB-addressable through the normal WS2812 controls. However, GPIO5 does independently gate the fan LEDs. The issue here is that the gpio_fan_led config setting was not being applied to the addon's runtime config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions