Inkplate Software
As described in part 3 of this guide, my approach is to display the image itself and not the byte array using the Inkplate Image Converter. I wrote about sibbl’s hass-lovelace-kindle-screensaver and that I use it to render an image of the Home Assistant lovelace view. However rendered images didn’t show up for me on the Inkplate, I had to do a little trial and error to get it working, as hass-lovelace-kindle-screensaver saves images as PNG.
PNGs or JPGs?
Although I have read somewhere that the Inkplate is able to display PNG images, it just didn’t work for me. Naturally I turned to JPG images. There are some code examples which show how to display JPG images on the Inkplate. Because these images did show up for me, I switched to JPG. sibbl’s hass-lovelace-kindle-screensaver uses ImageMagick to render the images and I changed the filetype to save JPGs instead of PNGs. I’m running the tool in a container, so I figured it would be the easiest to just fork the repository and make my changes there. You may just use the container image from my build instead of forking it yourself. More information on this in part 5 of this guide. My fork can be found here: https://github.com/itobey/hass-lovelace-screenshotter
After my change to save JPGs I noticed the images still not beeing displayed on the Inkplate. My manual test images, which I converted from PNG to JPG using Photoshop got displayed with no issue. Turns out the Inkplate cannot display the grayscale images (ironically) and a change to TrueColor images solved the issue. I’ve written an entire blog post on this issue which can be found here. The necessary change is also included in my fork of sibbl’s repository.
Please note that images straight from the tool cannot be displayed using the URL on the Inkplate, as the Inkplate needs a full qualified path, and not just localhost:5000. For this reason I needed to configure an Nginx server to display the image saved by the tool, so I get a full qualified URL, e.g. localhost:8080/output.jpg.
Programming the Inkplate
In a recent project I’ve used platform.io to develop on an ESP32. Unfortunately platform.io has an issue with the Inkplate library and I couldn’t get it to work. So I just went back to the Arduino IDE and followed the necessary steps to get it to work with the Inkplate.
My code can be found here. I’m not proficient in C, so excuse any misdeeds. We won’t be needing a loop-block because awakening from deep sleep will restart the setup-block. In the previously linked code examples there are also examples for deep sleep. If you’re interested in just using my approach, important lines are line 14 (how many seconds between deep sleep cycles) and lines 16-18 (SSID and MQTT configuration). The actual image is retrieved in line 45. Another important line is line 90, where the string for the MQTT message is concatenated. The format may seem strange, but I’m using Telegraf to scrape the MQTT message and put it into InfluxDB, from which I can retrieve it in Home Assistant. I also have my data to query over time to see how the battery behaves. I’ve written a blog post on how to achieve this here. If you’re not interested in having it in InfluxDB and just want to read it over MQTT, feel free to edit this line. I’m also getting the battery temperature in the lines prior to this, which is not displayed on the dashboard itself, but on another lovelace view in Home Assistant, that’s why it’s included in the MQTT message.
I am running the Inkplate in 3 bit mode, which allows me to display some grayscale values. You can also switch it to 1 bit so it’s just black and white. I’m a little disappointed in 3 bit, because I thought it covers more nuances of gray, but after some optimization on the colors in Home Assistant it’s alright. Fine lines and text is not very legible – I expected it to be better, but I suppose it’s alright, too. Just make sure your text is bold and no elements are too thin.
Hans
Interesting
Anonymous
Thank you for sharing this excellent write up of creating an e-ink smart home kiosk. I particularly enjoyed the architecture diagram.