Shutting down/switching on the Pi 4B with HassOS by a button press?


I have a Pi 4B for HassOS and I want to have a button to switch it on/off (with complete shutdown of HassOS!).

Is something like this possible?

There is eg. the Argon One case with a button for switching on/off. There is a script for Raspbian that handles this.
If you use a gpio with a switch I think the shutdown is possible but the power will not be switched off. I think you have to use a little bit hardware (shim?) to let it work.

Does someone ever managed to get such thing to work and made a description?

Thank you!

I don’t have any ideas for the turn on part of your question. Sorry.

To turn it off with a button, create a binary sensor using the gpio sensor.

Then create an automation to trigger off that binary_sensor and use the service hassio.host_shutdown in the action.

Thank you for the explanation!

This seems to be a solution to shut it down like I do it now with software. So I still can not see when the shutdown is ready.
It would be great if the Pi can be switched off after shutting down. But I think there is a little bit more hardware necessary.

Just to refresh this topic a bit instead of writing a new one.
I have a RPi4 with X735 power management board and button. There is an existing shell script for Raspbian Stretch with the following installation guide
Script exploits RPi gpios GPIO4, GPIO17 and GPIO18 for power management.
If I understand well, it should work within host not in core
Would it be possible?