Home Assistant dashboard on a rooted Kindle [Pupeteer] [compose]

inspired by @ChristianKuehnel 's thread I looked the first time into javascript.
Finaly had a day off so I was able to package it into an container.

Before running anything on the Kindle, one must first jailbreak it and obtain shell access, so root is required.
But when this is done it is as easy as

git clone https://github.com/Underknowledge/underknowledge.puppeteer-homeassistant /opt/puppeteer-homeassistant
cd /opt/puppeteer-homeassistant
cp .env_example .env
# Provide your details
vi .env 
# optional
# vi home_assistant.js 
docker-compose up -d 

The script will run by default once a minute. you’re free to change this schedule

The puppeteer script will create a screen shot like this

convert it to grey scale,
copy it to the kindle,
And open it

When you still want to use your kindle to read, set the brightness to max and wait for an not occurring update.
(The process will sleep for how long as you set it)

Well, have fun :tada:


This looks very interesting indeed! I’m right in the middle of trying to set up the dashboard view for my Kindle following @sibbl solution (hass-lovelace-kindle-screensaver + Online Screensaver extension). Your solution seems even simpler to set up, but a bit less user-friendly if one still wants to use kindle as an e-book reader. I wonder which of the two is less resource-hungry for our precious fanless servers?

Well, simple :sweat_smile: you still have to root your kinle sand setup ssh with a password, but yea then its just chaning a file and run docker-compose up.

I cant really say what is less resource hungry.
If I would have known that it exists, I might have used this instead, well… to late now I guess xD

Chrome is rather needy, but both set-ups are based on this.
Before doing any chrome work I also check if the reader is online. this might help with hungryness.

I had the same need. You still can use the kindle I check here for the brightness and when it exceeds 240 (254 is max) it sleeps for an couple of hours.

Just realised, not certain if it works with other models then the PW1 :sweat:

Thanks for mentioning my project :slight_smile:

I really like how different the approaches to bringing a HA dashboard to Kindles can look.

My project outsources the rendering completely to the machine where the docker process runs. This is done regularly (like every minute) and it doesn’t care if there’s any Kindle online or not.

The Kindle itself fetches it and sleeps the rest of the time. So the focus on my project mainly was that it can run several weeks on battery only and I also assumed you don’t use it for reading anymore.

I guess the latter could be solved by providing a KUAL integration so the daemon (which fetches the image and regularly goes to sleep) can easily be started and stopped.

However, I’m currently investigating another approach where you run Home Assistant in a full screen browser on Paperwhite 3+ devices. Which then again requires battery all the time but also allows you to interact with the dashboard via touch. This won’t require any other docker rendering processes running somewhere.

I decided to stick with your solution mainly because of the possibility to run on battery for several weeks. Not quite there yet, as I’m having unresolved issues with the online screensaver extension. It updates the screensaver image only once. I’ve JB my PW3 (5.14.2), installed the latest KUAL and screensaver hack, copied online screensaver extension to kindle, and corrected a few things as suggested.

There was an issue with scaling (blurry output) for some frontend integrations that rely on canvas (this for example), but the solution was to put the scaling value (which should now be an integer) as a “deviceScaleFactor” attribute of the size parameter instead of “transform: scale” in the style of body tag.

In the beginning, I thought to keep the kindle plugged 24/7 attached to the wall then someone suggested against it as it may harm the battery. There’s a way to remove the battery and trick the kernel to power on the device, but I’m not confident enough to try it.

Hi Sibbl. İs there any detailed youtube video about your project which shows us installation ? I can install it to docker via terminal in mac but I don’t know what do to after then. I want to use your project to get snapshots of my graph page and then reflect it to my firetv so that my household members can also see it.

Hi @berkans, I’m a bit unsure whether this project is the right approach for you. A FireTV is a) not eink and b) can run a full features browser. So no need to use this project to render the dashboard to an image which can be shown on devices with very limited hardware like a Kindle.

I’d suggest to take a look at the many tutorials to display you HA dashboard on Android devices. The FireTV is technically the same as an Android tablet with an external display (the TV).

Hi Sibbl. Thank you very much for your responce. Actually the main thing I am trying to do is to get a snapshot. Thats all. I am not interested with any forward kindle process. The reason behinde me wanting to project a picture is I want to use android tv notifications for certain purposes. I am also going to connect these jpeg snapshots to firetv to display it to my family members. Like when a certain period of Netflix is consumed a graph should project to firetv to warn people. And to do that the only way to take a snapshot of a ha url is your project.

Other projects such as displaying to android tv onlu works on firetv browsers and is not an efficient method.

I’ve been looking for something like this, thank you!

Question: is there an easy recipe for how to convert this into a Home Assistant Add-On?

I tryed my luck a litle,
But when I remember right I had my issues getting headless chrome into the container

Thanks! I tried it on amd64 and after a lengthy install/build (5-10 minutes) it is willing to start.

However, it goes into a restart loop

[19:08:15] INFO: Service restart after closing
[14:08:16] INFO: Test set:
[14:08:16] INFO: Hello world...
  File: /usr/src/app
  Size: 4096      	Blocks: 16         IO Block: 4096   directory
Device: c2h/194d	Inode: 1050718     Links: 1
Access: (0755/drwxr-xr-x)  Uid: ( 1000/    user)   Gid: (  999/    user)
Access: 1969-12-31 19:00:00.000000000 -0500
Modify: 2023-01-02 14:06:29.000000000 -0500
Change: 2023-01-02 14:06:42.572922340 -0500
 Birth: -
Kindle not connected to the Network, or it has now another IP

presumably because I don’t have a kindle connected :slight_smile:

Is there a way to configure Puppeteer so that it just dumps the image, without trying to login to the Kindle?

Maybe I need to edit usr/src/app/homeassistant.sh ?

Not had in mind that someone might just want the picture :smiley:
yea homeassistant.sh stops execution when a ping cant be sent.
Theoretical you could set it to any other IP but to be honest, there is more stuff wrong. The addon is not working at this state.

Sorry to hijack this thread with a support issue for puppeteer screenshots.

I have been playing with both @Underknowledge and a fork of @sibbl 's code/add-on to setup an inkplate as a “homeplate”.

I get the error “Unable to connect to Home Assistant” when taking the snapshots from both codebases.

I hope either of the developers of these great snapshotting tools might be able to offer some advice on the error. My snapshots all look like:

I am running home assistant on an odroid-n2 with Home Assistant OS. Add-on logs are:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
 Add-on: Lovelace dashboard renderer
 Renders any lovelace dashboard to image and hosts it
 Add-on version: 1.1.13
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.5  (aarch64 / odroid-n2)
 Home Assistant Core: 2023.3.5
 Home Assistant Supervisor: 2023.03.1
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
INFO: Starting Node server...
INFO: Using base_url: http://homeassistant.local:8123/
> [email protected] start
> node index.js
Starting browser...
Visiting 'http://homeassistant.local:8123/' to login...
Adding authentication entry to browser's local storage...
Starting first render...
Starting rendering cronjob...
Server is running at 5000
Rendering http://homeassistant.local:8123/dashboard-inkplate/0?kiosk to image...
Goto completed
Wait for selector completed
Added style tag
Wait for timeout completed
Screenshot completed

I get the same error/screenshot if I access over the DNS address shown, the IP address or my nabu casa cloud address.

Any help from your experiences, even if just to point me in the direction/logs to understand the problem better, would be greatly appreciated.

No Worries, have fun hijacking.
As of addon, Better to use sibbl/hass-lovelace-kindle-screensaver, my Add-on implementation never worked, but the docker-compose build does.
Unfortunately, at this stage of my life, I don’t have the luxury of time to devote to add-on development.

1 Like