Introduction: Add a Power Button to Your LibreELEC Installation on a Raspberry Pi
In the following we will learn how to add a power button to LibreELEC running on a Raspberry Pi. We will use a PowerBlock to not only add a power button, but also a status LED that indicates the power status of you LibreELEC installation.
For these instructions we need
Step 1: Download LibreELEC
For these instructions we are going to install LibreELEC on a Raspberry Pi. Therefore, we go to https://libreelec.tv/raspberry-pi-4/ and click the .img.gz link to start the download.
Step 2: Install LibreELEC on an SD Card
Now we are going to load the downloaded image to an SD card. I recommend to use Etcher for that. You can find it at https://www.balena.io/etcher/. It is a tool for writing SD card images and is available for all major platforms.
Step 3: Hardware Setup
When you have loaded the LibreELEC image onto the SD card, put it into the Raspberry Pi. If not already done, connect the HDMI cable and the Ethernet cable with the Raspberry Pi.
Then attach the PowerBlock to the GPIO header of the Raspberry Pi.
Attach a power button and, optionally, a status LED to the PowerBlock.
Finally, attach the USB power cable to the PowerBlock.
Step 4: Power on and SSH Into LibreELEC
Switch on the Raspberry Pi with the power button and wait for LibreELEC to finish booting.
Next we want to SSH into the running LibreELEC instance. Therefore, we need the IP address of it. You can find it, e.g., via the settings - network menu from within LibreELEC. Log into LibreELEC with the tool of your choice. From a Mac or Linux command line, e.g., you could call ssh root@IP_OF_YOUR_LIBRELEC_INSTANCE. The default password of LibreELEC is libreelec.
Step 5: Installation of the PowerBlock Service
For the installation of the PowerBlock driver we follow the instructions from the official Github repository. Install the PowerBlock service with the following command:
wget -O - https://raw.githubusercontent.com/petrockblog/PowerBlock/master/install_libreelec.sh | bash
The installation finishes and the driver is started automatically.
Step 6: Test, If It Is Working
With the driver being installed, you should be able to switch off and on the Raspberry Pi with the power button that you attached to the PowerBlock.