Gave up on HA Cast, now building HA Monitor (Help wanted!)

For a long time now I have been trying to make Home Assistant Cast work for me. But it just doesn’t; for several reasons:

  • None of my camera’s seem to be supported.
  • Custom Lovelace cards are not supported either
  • I want to use it with a TV and then input is not possible
  • It depends on Google - what about “local first”?

So I deciced to change my approach and build a “Home Assistant Monitor” based on -of course- an RPI. Main features are (to be):

  • Full support for the Home Assistant UI in a kiosk-style display
  • Support for any monitor connected to the RPI
  • Navigation by touch, connected mouse/keyboard or TV remote (over CEC)
  • Ability to play music through the display
  • Ability to show camera streams full-screen
  • Controllable from Home Assistant

The concept is to have an RPI ZeroW (or other version) behind the TV/display which acts as a kiosk browser for the HA ui. I have been working on this for the past hour or so and have gotten a long way already:

  • There are plenty of examples of how to turn an RPI into a kiosk browser
  • I installed lib-cec from Pulse8, and can see the remote buttons coming in on the RPI.
  • The unofficial integration browser_mod allows control of the RPI browser from home assistant.
  • The unofficial integration kiosk-mode allows hiding of the toolbars (note: there currently seems to be an incompatibility with browser_mod)

I already got some interesting results, including full-screen video on the first try! (Kiosk-mode + lovelace view in panel mode).

The only downside I have found so far is that the HA interface is not optimized for keyboard navigation, which may make control with a TV remote somewhat cumbersome.

To be honest, I think this would be the much more elegant solution to get HA on any display. It does not depend on any external service and can be completely open-source.

Help wanted! I only have enough time and programming knowledge to make this into some sort of Frankenmonster proof of concept which would work for me personally. If anyone is willing to work on this, let me know. I’d love to exchange ideas on how to get this to a proper solution. Ideally we end up with something like the app for mobile, but then for TV’s and Touch-displays!

Thomas

1 Like

So you have discovered the web browser? Well done. Silly comment, sorry

What a sad reply. I don’t mind if you don’t like the idea or don’t think it is novel in any way, but there is no need to act like this on an otherwise positive and helpful forum. You could have just asked/challenged why I see this as more than just a browser, but it seems you’re not interested in that at all.

I am talking of configuring an RPI to act as a controllable interface for Home Assistant. So, yes, a web browser is the main part of it. But as explained in my post, there is more to it than that. It’s about getting an RPI to behave like the app with deeper integrating with the back-end and also direct control from any cec-enabled tv. It could be an alternative to the Home Assistant Cast function which is causing headaches for many people. Sure, it’s not a gigantic project, but it may be helpful to more people than myself.

Again, fine if you don’t like it, I won’t even mind if I’m the only one in the world who thinks this is a good idea, but there is no need for such sharp comments.

Thomas

7 Likes

Perhaps I understand better now, sorry if that was a bit negative.

Control a web browser via a remote is tricky. Quite a bit has been done on kodi for that. You might find some good info on their forum.

I know there is a chromium addon for libreelec (a kodi distro) so their forum might also be a good place to look.

Which app?

Just a shot in the dark.
Is Windows IOT Core an option?
I don’t know if the more “applike” Microsoft store stuff is available on that.
Haven’t heard much about that lately.

I was talking about the Home Assistant Companion app which has a tight integration with the backend.

In any case, where I am now is:

  • cec-control: working. Using lib-cec and xdotool in a bash script I can control the mouse and keyboard with my remote. Still looking into what the best mapping is as I have Samsung smart TV’s with very few buttons on the remote.
  • kiosk mode: working as well.

To be honest, I’m already really pleased with this result. Sure, the control is still a litte bit jerky, but it works. I had some problems with my camera stream, but then I discovered I had recently put my Pi in a metal enclosure; that does not mix well with the wifi :slight_smile:

Next on my list:

  • Bring up the network config panel when there is no connection to lan/wifi.
  • Use avahi to discover the (first) home assistant host on the network and automatically connect to it so there does not have to be a hard-coded url in the script.
  • Test what browser_mod has to offer in terms of playing media and automation.
  • Switch to a ZeroW in the hope this has enough processing power
  • Stretch goal 1: do away with the desktop and set up a minimal install.
  • Stretch goal 2: run a local webserver on the PI to be able to edit settings.

As said, I’m hacking this together with Bash scripts so it ain’t pretty, but I’ll set up a repo later this week where I’ll share what I have.

Thomas

Just a thought, cec is not going to work on non tv monitors is it?

Have a look at a similar project of mine.

2 Likes

You are right, cec won’t work on non-TV monitors. I see two main uses, similar to Google Cast:

  • TV connected, using the remote control for input.
  • Desktop, using a small (7") monitor, somewhat like the Google Nest Hub. This could even be a wall mount/in-wall monitor as well.

For other situations one could use a wireless keyboard/mouse, add an IR receiver or build a keypad with physical buttons.

I have the TV-version with simple remote control running for some days now and it seems to work quite well.

Thomas

Looks interesting! I’ll dig into it when I have some time to get more inspiration.

Meanwhile I have made a lot of progress. I started from scratch with a Raspbian Lite install. On this I set up a minimal Chromium browser which opens the home assistant url.

I also changed the control from bash-scripts as they were too slow. I now have a python script which uses pyautogui and cec to control the mouse. The experience is a lot smoother this way. I hope to have some more time this week to add the automatic discovery and better control of the gui.

EDIT: Things are progressing way faster than I had hoped. I am now at the point where the script automatically finds HA through Zeroconf on startup and directs the browser to it. Still very crude, but it works.

Thomas

Another small update after spending my lunchtime on this :wink:

  • Changed from Pyautogui to Pynput => this allows me to detect mouse / keyboard input as well so later I can add functions for when the screen is idle (like looping through some views)
  • Now when I run startx to start the X session, it also launches my Python script which opens the browser and points it to the HA-url.
  • I have added startx to .bashrc so this is run upon login. With the pi set to autologin, this automatically starts the interface.
  • Ideally this would integrate with HA as a native app (https://developers.home-assistant.io/docs/api/native-app-integration/) but I don’t think my coding skills will suffice to get me there. I’ll take a look at it though when I find some more time.

First on my to-do list is adding a check for a CEC-adapter and, if it is not present, skipping all that code. Then I will be adding some “idle” functions; I would like my tv to show a sequence of some views when it is not in use.

Thomas

I’d love to see some sort of complete guide come out of this one day.
I’d love to build a better Google Nest Hub that does exactly what I want, as opposed to some of what I want.
A

  • Parts list of readily available DIY parts

  • Software manifest

  • Installation guide hardware/software

I have a Pi 3A that I’d love to put to some use better informing the family and myself what’s up with the house, the weather, and maybe cycling through some photos ideally pulled from iCloud but I know Apple’s hard to get info out of.
It could start as a local folder we manage.
It could all be lovelace if there’s some sort of custom component (I think there is) that can automatically control a browser to change the lovelace tabs.

For sure I will share everything once things become more stable. I am still in the “experimental” stage, so there is not much point in sharing everything yet.

I have ordered some parts to build both a Chromecast replacement and a Nest Hub replacement. Once I have them and can confirm they work I will put everything up on my GitHub Repo so other people can use it as inspiration or even shopping list.

Thomas

1 Like

I’ll be watching this intently too! All I’ve ever wanted is a Google Nest/Chromecast alternative that works exactly how I want it to.

I’ve salvaged an old laptop screen from a broken laptop as a monitor, just waiting for the converter to arrive and I will be plugging in my Pi 3B and seeing what can be done. Taking a lot of inspiration from @valvex on how it will look too

1 Like

This looks like it would fit the build as well:
https://www.amazon.com/Raspberry-Pi-7-Touchscreen-Display/dp/B0153R2A9I

I’d love to monitor my apple TV for “idle” and then start playing on it an ambient display of lovelace, weather, pictures as well.
That’s another topic…

Edit: I’ve proven I can play a camera stream to the Apple TV so it’d be sweet if there was some RTSP generator that would play lovelace cycling between the three tabs.

Sorry resume on topic discussion…

@thomas-be My initial approach was to try with a Pi ZeroW following the same procedure as you have.
However I had issues with the screen resolution. The pi wouldn’t connect to the screen with any resolution above 800X600, so i had to find a different way.

I then tried with a chromecast gen1. The bultin HA cast function would not work, since most of the custom cards would not load at all.
I tried using the catt tool: catt cast_site 192.168.*.*:8123 . This worked perfectly but the chromecast would reboot or lose connection itself, so it was not reliable.

After that, I tried with on old tablet that had an HDMI out, but it soon died.

As a last resort, I invested in a mi box s making use of the awesome fully-kiosk browser.
I haven’t had any problems since.
Also, the fully kiosk provides a web interface with which you can control the screen and also has rest commands to integrate with HA.
With an external wireless usb mouse it behaves as if you’re controlling a PC.


Good luck with your efforts!

Finally, @jonnyrider some more screenshots, including a live view of my cctv cameras, a view with live statistics from the house etc

  • ingore the Stay logged in pop up. The App updated and I haven’t yet clicked the OK button.
1 Like

I just received all the goodies I need to continue development. The plan:

  • Basic setup of kiosk using matchbox & chromium
  • Add functionality with Python3
    • Enable CEC control with cec and pynput to enable control with tv remote
    • Capture HID input with evdev to shield browser from unwanted input, use pynput to send through filtered events (not sure about this one yet)
    • Show/hide virtual keyboard (matchbox) with a specific remote button or touch-screen long press (maybe with this)
    • Add a local webserver for configuration with bottle
    • Allow for wifi-setup with the wireless library
    • Allow entry of HA address manually and through zeroconf
    • Get info from chromium through selenium, in the hope to discover if a textbox/area has been clicked so I can auto show/hide the keyboard

This should get me to the (MVP) minimal viable product of the monitor. I have almost all of the above working, but not in a nice single apllication, so that’s why I’m starting over.

In a later stage I want to implement Native App integration to allow tighter integration with HA. But first things first, I need to get the basics working before I can even consider that.

Thomas

2 Likes