In the following we will learn how to add a power switch for 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
- a Raspberry Pi
- Raspberry Pi accessories like power supply, SD card, ethernet cable
- a PowerBlock
- a power button and cables for attaching it to the PowerBlock
- (optionally) a status LED and cables for attaching it to the PowerBlock
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.
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.
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.
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.
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.
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.
Have fun!