Argon one v3 power button and fan scripts issue

@Enc ,

it seems that the cable by clever routing is long enough to connect to the RPi5 directly. After that you shouldn‘t need a script for fan control. It‘s okay if you doesn‘t need the fan control depending on different sources like CPU + HDD/NVMe + GPU at the same time. The argon1.sh script installs a script which observes different temperature sources, if the fan is plugged in the case internal connector.

Without the argon1.sh script, you will have no support for different power button events. This can resulting in, that you don‘t have a graceful shutdown and the power button does nothing or only power cuts (without shutdown initiated)

@smesser,

what I know and can confirm is that the Handle Power Button Events option currently requires a reboot to reflect the changes.
This is specifically noted in the line of text below this option. It’s on my to-do list to try to change that.

But when I start KODI, I can disable the add-on and the fan control + power button detection is turned off. When I activate the add-on again, the power button detection works immediately.

Can you please provide me with an ordered list of the steps you follow until it stops working? Maybe I can reproduce it here then.

Hey @HarryH , thanks for your clarification! I will go for the regular ONE V3 without NVME support because for my use case I will be swapping SD cards quite often. :slight_smile:

But the more I think about it, I will probably go for the script after all. Having a functioning pwr button would be neat and since some of the more “modern” retro emulations (PS2, Nintendo Wii) will probably tax CPU & GPU quite a bit it would be nice to have a more granular control over the fan. I´ll see what I’ll do once the case arrives. :slight_smile:

Thanks again for your help!

Scenario 1:

  1. Start with unit powered off
  2. Press the Button and the units turns on.
  3. Once booted go to the “ArgonForty Device Configuration” addon
  4. Click configure
  5. Click disable
  6. Click enable
  7. Double press does nothing.

Scenario 2:

  1. Start with unit powered off or just do a reboot after scenario 1
  2. Press the button twice
  3. Unit reboots

Takeaway: Any time I disable/enable the addon I have to reboot before the button detection works again.

@smesser,

currently it looks like an issues with lgpio. But I can‘t differentiate if it happens only in combination with a RPi5. To isolate this, I need a little bit support from you.

Scenario 1:

Please can you check if a pipe file from lgpio is there ?
ls -la /tmp/.lgd-nfy*

Check it two times:

  • after KODI was started with add-on enabled
  • immediatly after you disabled the add-on

If the pipefile is there after you have disabled the add-on, please try to delete this file. After that, enable the add-on and please look if the button detection works.

Scenario 2:

Please do this during the add-on is disabled, to prevent additional distracting error messages.
Change these lines (44 - 49) in /storage/.kodi/addons/script.service.argonforty-device/resources/lib/argon.py

if pi.model == '5B':                                                                                                                   
        import importlib.util                                                                                                          
        lgpio_spec = importlib.util.find_spec("lgpio")                                                                                 
        if lgpio_spec is not None:                                                                                                     
                from gpiozero.pins.lgpio import LGPIOFactory                                                                           
                Device.pin_factory = LGPIOFactory(chip=4)

to

#if pi.model == '5B':                                                                                                                   
#        import importlib.util                                                                                                          
#        lgpio_spec = importlib.util.find_spec("lgpio")                                                                                 
#        if lgpio_spec is not None:                                                                                                     
#                from gpiozero.pins.lgpio import LGPIOFactory                                                                           
#                Device.pin_factory = LGPIOFactory(chip=4)
from gpiozero.pins.lgpio import LGPIOFactory                                                                           
Device.pin_factory = LGPIOFactory(chip=4)

@HarryH

Scenario 1:

  1. after KODI was started with add-on enabled
    command yielded: /tmp/.lgd-nfy0

  2. immediatly after you disabled the add-on
    a. command yielded: /tmp/.lgd-nfy0
    b. pipe never went away

  3. If the pipefile is there after you have disabled the add-on, please try to delete this file. After that, enable the add-on and please look if the button detection works.
    deleted pipe then enabled the addon.
    Button detection did not work

    Note: created a new pipe named /tmp/.lgd-nfy3 once enabled after the delete

Scenario 2:

  1. Change argon.py as directed

  2. after KODI was started with add-on enabled
    command yielded: /tmp/.lgd-nfy0

  3. immediatly after you disabled the add-on
    a. command yielded: /tmp/.lgd-nfy0
    b. pipe never went away

  4. If the pipefile is there after you have disabled the add-on, please try to delete this file. After that, enable the add-on and please look if the button detection works.
    deleted pipe then enabled the addon.
    Button detection did not work

    Note: created a new pipe named /tmp/.lgd-nfy6 once enabled after the delete

Both scenarios yielded the same result

@smesser,

I can’t promise that it helps, but I changed a lot of things with 0.0.11d. Please try this version. During troubleshooting it now makes sense to switch the protocol to Debug. You will then receive messages from the “Argon40: …” plugin and can see directly in the kodi.log whether the button monitoring is working or not. If not, we may get a clue as to where something is wrong.

@HarryH

Yes, it behaves as before. Here are the logs for your perusal.

https://paste.libreelec.tv/honest-chipmunk.log

Thank you for providing the log. It wasn’t a kodi.log with debug logging enabled like I hoped, but I could see why. :wink:

The GPIO pin for power button monitoring cannot be released.
This is a general issue with the gpiozero/lgpio combination, not specific to this add-on or RPi5. It affects all versions so far. I’m currently looking for a solution to this.

@HarryH

Thanks for all your hard work!

I am a C# guy so not much help with Python.

@smesser,

please try v.0.0.12. The disable/enable issue should be resolved. What I can’t fix at the moment is that KODI thinks to terminate the thread because it’s running against the 5 second timeout. It’s an internal delay of lgpio.

@HarryH

  1. Installed version 11
    a. Button detection didn’t work
    b. I disable/enabled the addon. Button detection didn’t work.
  2. I rebooted and button detection did work
  3. I then disable/enabled the addon and button detection did work.
  4. For good measure I went into the addon’s configuration page and clicked okay
    a. Button detection still worked.

Was fine once I rebooted after updating to version 11.

Here are the logs if you need them

https://paste.libreelec.tv/amused-stinkbug.log

@smesser,

I have published version 0.0.13 with temperature display support in Fahrenheit. :wink:

1 Like

You rock, thanks. I will check it out soon.

Anyone have any idea how to install the control scripts on zynthian?

Now that Raspbery pi OS has updated to use Debian trixie. The script has some new issues. The fans and M.2 drive seems to work fine. However, shutting down the pi does not turn off the power. The script will need an update.