Sharing my home assistant integration + raspberry pi display

So one of the things I dislike about streaming is the lack of visual feedback (I know you wouldn’t get that with CDs/Vinyl in the “old days”, but you’d at least have the physical thing lying around).

One of the big draws for me with roon was the display functionality. Whilst I have had some trouble with chromecast display, the web display seems to work flawlessly. So I decided it would be quite cool to have some screens around the house with “now playing”, “lyrics” etc.

So far, for this I have repurposed an old samsung tab A 10inch running fully kiosk and connected to the web display, and a raspberry pi running firefox in kisok mode on a pimoroni hyperpixel 4.0 display.

One of the issues I had with the fully kiosk display on the tablet was that the screen would either go off after some time, OR I’d have to leave it on permanently and manually turn on and off.

Since I already run home assistant, and it has a roon integration with status changes to the endpoints, AND fully kiosk has a REST API that can be used to do things like turn the tablet display on/off, I decided I could automate the process such that the display would turn on when roon is playing, and after a configured delay, turn off when roon is stopped/paused. FWIW, the actual logic for this part is configured using nodered, in conunction with the state data from home assistant.

If anyone wants more details, happy to talk more.

4 Likes

Yes, please tell me about your pi & display, with pics :slightly_smiling_face:

Yes, more details please! I am tempted by home assistant, I have been doing a bit of a overhaul of my IT software and hardware and I was about to embark with OPNsense on a new router next. Then I was thinking of getting a new server with Unraid and then home assistant.

Looks great - one of the things I love about open source software is that you never know what people are going to use it for, so lovely to see an unusual use for the roon / home assistant integration.

With regards to the pi, it’s very simple - just a pi4 running raspbian. The display is a pimoroni hyperpixel 4.0 (non-touch, rectangular) : HyperPixel 4.0 - Hi-Res Display for Raspberry Pi – Pimoroni

Physically, the screen is very easy to install, it just slots onto the pins of the raspberry pi, and then you need to install some software.

https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-hyperpixel-4

If all goes well, then installation of the display software should be very easy. However, I wasn’t running from a ‘fresh’ raspbian install and hit some issues that required a bit of digging and faffing to figure out.

The screen is configured to be rotated 90 degrees into landscape mode.

On startup, the pi is configured to autologin and run firefox in kiosk mode and to navigate to the roon web display URL.

 /usr/lib/firefox-esr/firefox-esr --kiosk http://<roon_ip>:9100/display

The display then becomes available within the roon app.

In my case, I have set the display to automatically start on playback within the roon app.

On the pi,

  • I need to figure out a way to switch the display off when music is not playing - I’ve already solved that one on the tablet using the fully kiosk browser.
  • I need to put together a nice case to contain it. At the moment, it just looks like a raspberry pi with a screen (or “bunch of electronics” to the layperson). It’d be good to make something a little nicer - though this is going to be a DIY effort since there’s nothing off the shelf I can buy.

That’s pretty much it.

Were there any other photos or information you wanted?

3 Likes

In the process of putting the process into some logical, readable format :slight_smile:

1 Like

Hi everyone, apologies for the delay in following up. Slowly getting the blog going again, and I’ve written a first post about the integration - no details on the pi4 for now, but that’s coming in the next post. Hope it is useful, happy to answer any queries on the link below. Thanks!

1 Like

i wonder if there’s a way to direct the display to an Amazon Echo Show?

I don’t have one, but it seems it could be possible.

Just use the roon display URL instead of the Home Assistant one?

1 Like

Using HA, “Alexa, show me roon” seems like it would be nice.

holy crap, it works.

1 Like

Yes, it does, as does using the web controller extension :wink:

1 Like

Just thought I’d check to see how you went with this project in regards to having the Pi display automatically turn off when not in use? I’m thinking perhaps of using a square display (such as HyperPixel 4.0 Square - Hi-Res Display for Raspberry Pi - Pimoroni) and only displaying album art. Curious if a year later this project still meets the needs, or if you’ve advanced to something even better. :slight_smile:

Hi @Mark_Dorset - sorry, I’d totally forgotten about these posts!

Everything is working great, so I haven’t bothered to look for alternative approaches.

With regards to Home Assistant and having the screen turn off, that was two-phased.

  1. Create an on/off switch in home assistant for the control
  2. Create the automation to detect status changes in roon (playing, or not) and then turn the screen on or off

For the first part, I was able to allow the server running home assistant an ssh login to the pi to run a command, and then create the switch based on that:

- platform: command_line
  switches:
    rpi_screen:
      command_on: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_ed25519 pi@192.168.xx.xx "echo 0 | sudo tee /sys/class/backlight/rpi_backlight/bl_power" 
      command_off: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_ed25519 pi@192.168.xx.xx "echo 1 | sudo tee /sys/class/backlight/rpi_backlight/bl_power" 
      friendly_name: Raspberry Pi Screen

For part 2, I used node-red to react to status changes on the Roon media player in home assistant.

When the status changes to “playing”, turn the above switch on, and cancel any timer (see below).

When the status changes to off, set a 15 second timer. If the timer elapses, turn the switch off.

I hope that makes sense!

1 Like

Good to hear this is working for you.

One idea - home assistant automations have a for parameter that delays triggering until the device have been in that state for a period of time.

So might be easier than setting your own timer.

Thanks @GregD - that’s a great tip, cheers!

1 Like