17 February 2021

My dad built us a "fake fireplace" as decoration some time ago. Actually, it was a gift for my wife’s birthday. After beeing placed in the hall for some time, it finally found the perfect spot in our living room. With its new spot also came a power outlet right behind it. We thought it would be nice if the fireplace actually would be even "more fake"; so I got a spare Monitor, a Raspberry Pi and added a few lines of Java using Quarkus and JBang.

Firestarter is the final result. Essentially, it opens a browser in fullscreen and plays whichever YouTube clip you have configured. As I do not want to ask my wife to connect to the Raspberry Pi via SSH to change the clip, I added a small web-interface that can be easily opened on the phone.

Installation

First, check via java -version if you have JDK 11 installed on the Raspberry Pi. If not, run

sudo apt install default-jdk

The simplest way to use Firestarter (which uses JBang) on the Raspberry Pi is via the zero-installation approach:

curl -Ls https://sh.jbang.dev | bash -s - firestarter@38leinaD

Autostart

If you would like to have Firestarter autostart after booting to the desktop, you just have to place below file in ~/.config/autostart/

firestarter.desktop
[Desktop Entry]
Type=Application
Name=firestarter
uomment=Starts the firestarter app on startup
Exec=/bin/bash -c "sleep 10 && curl -Ls https://sh.jbang.dev | bash -s - firestarter@38leinaD"
NotShowIn=GNOME;KDE;XFCE;

The sleep is just to wait a few seconds after boot so the Wifi is connected. Otherwise, the curl might fail. There are more reliable alternatives but it is good enough for me.

Move mouse

I had the problem that the mouse was placed on the taskbar after boot. That position is over the YouTube clip in Chrome later on and thus title and controls will stay visible. To move the mouse out of the way, I used the answer to this stackoverflow question and removed @point-rpi from /home/pi/.config/lxsession/LXDE-pi/autostart.

Changing the Fireplace Video

Open http://pi.local:8080/firestarter (or whatever is the name/IP of your Raspberry Pi on the local network) from any Browser in your local network and paste the Url of a YouTube clip.

This one is especially nice if you are a fan of pixel-art: A Pixel Fireplace.

JBang Installation on Rasperry Pi

Just as a side-note: JBang is just a great tool for writing small scripts with Java. There are multiple ways to use/install JBang on the Raspberry Pi. One possibility is to install it via Snap. Unfortunately, it does not have the latest version of JBang currently (see here). So, firestarter will not work with the JBang version from Snap currently. Once the JBang version on Snap is updated, you could use it like this as well:

sudo snap install jbang --classic
jbang run firestarter@38leinaD
Note
Update: As of now, Snap hosts JBang 0.66.1 which is the latest version and is working with firestarter as well.