feature-requests
feature-requests copied to clipboard
M5Paper support
Describe the problem you have/What new integration you would like
I've got my hands on the M5Paper from M5Stack and would love to use the e-ink touch display to render switches and buttons that communicate with HomeAssistant through ESPHome. I have no idea if this is the correct place to put this request, as I'm fairly new to programming micro controllers.

Please describe your use case for this integration and alternatives you've tried:
I've searched the documentation of ESPHome to find a way to interacht with the touch screen and e-ink display of the M5Paper, but I could not find something useful or something that worked. It might be my own shortcoming, as I do not have that much experience with ESPHome or ESP32 in general.
Additional context
It might be noteworthy that M5 already has their own library M5EDP to do basic stuff with the M5Paper. This might be a starting point? The link to the Github M5EPD project also contains a bit more information about the device and the hardware configuration.
I would love to help out in any way, as I'm a programmer myself. But the problem is that I don't have experience with C/C++. I've tried some things, but a lot is unclear to me of how it works. With some help form someone more experienced I think I would be able to provide a PR to add support for this device.
Gets a big thumbs up from me. Mine just arrived and would love to be able to tie it in with ESPHOME and HA. It's a nice bit of kit :)
Here's the M5 docs on the APIs and relevant functions for the device if they help at all?
- display - https://docs.m5stack.com/#/en/api/m5paper/epd_canvas
- touch - https://docs.m5stack.com/#/en/api/m5paper/touch
- system button, RTC and onboard SHT30 sensor - https://docs.m5stack.com/#/en/api/m5paper/system_api
The touch screen is an i2c device, using the Goodix GT911 controller https://www.distec.de/fileadmin/pdf/produkte/Touchcontroller/DDGroup/GT911_Datasheet.pdf
Sadly, like megawubs, I've not got much C/C++ experience
Ive been trying to get a sample ESPHome project to compline with the M5EPD project as a custom library, but this gives me too much errors that I cannot resolve. It's complaining about a lot of unknown references. Especially the SD reference. I've forked the M5EPD library and tried to remove the SD stuff in there but that's a too deep rabbit hole for me atm.
I think a better approach for me right now is to just work with the M5EPD library in combination with the M5Paper UI library and publish/subscribe to mqtt stuff. It seems it's too difficult to just "merge" the two projects together.
I'm working myself on a m5paper panel, for openhab and without esphome. I already have a working proof-on-concept on https://github.com/cyrilpawelko/m5panel It's not complete (no touch support for example), but can be used as a starting point.
@megawubs it will give you errors since the M5EPD project relies on the Arduino libraries. Take a look at the Waveshare Epaper component for examples on what to replace with what. E.g. the M5EPD library uses this include for SPI support:
#include <SPI.h>
However on ESPHome, you need to use this:
#include "esphome/components/spi/spi.h"
I'd also not hold my breath for SD card support.
Also, there's a lot of work to be done on the separate components of the M5Paper to make it completely usable. Battery voltage reporting would be nice to have (might be tough due to the different ADC setup in M5EPD), touchscreen is probably doable, but you won't be able to do much with it... You'll need to supply your own STH30 module as well.
@cyrilpawelko I'm not sure that your PoC will be of any use, since it relies on the Arduino framework fully. ESPHome provides its own framework, with different includes, different available packages, and so on... Porting everything wouldn't be an easy task, and I'm fairly certain the developers wouldn't want to pull in so many extra resources. The point of ESPHome is to create components that integrate with HomeAssistant, and most of the stuff is not meant to run on its own. The M5Paper's full support requires a level of independent functionality that would be way out of scope for this project.
@fonix232 thanks for your reply. This is what I was afraid of. I think I have to wait for M5Stack to fully support this device with UIFlow and micropython.
That said, do you know if it's possible to get the home assistant protocol esphome uses to work outside of esphome? If I can include that within the M5EPD project it would be a great step forward. I've been trying with an home assistant rest client, but that's a big hassle to get working correctly when you use https.
@megawubs according to m5stack, you need to use the "beta" selection when you start uiflow. I just downloaded it (just found my m5paper in the mailbox half an hour ago) and confirmed it's in there. havent touched micropython yet.
@jhoult I'm not seeing it when I open UIFlow 1.7.2 beta :(

Would also love to see the M5Paper supported by esphome.
Following as I'd love some support here.
+1 to this, so I can use home assistant with this.
Have a few m5papers here, but haven't started yet as it is not on my top priority list....
https://github.com/richardklingler/esphome
I'd add my support for this too
Same here. M5Paper seems like a perfect fit for esphome.
Agreed, this would fill a lot of different use cases for me if it were running esphome.
This would be a great addition to home assistant.
m5paper push ... ;) would like to use the m5paper as a remote would be perfekt for this
Such a neat looking device. Support would be great!
is there something new ? (push - again, because the device is realy nice)
+1, would be great!
I've started bringing up the individual peripherals. I think the display will be the most challenging (as previously stated). The rest are somewhat simple i2c devices.
I'll post a git repo with some external components as soon as it's in a better state.
Does anyone know if it is possible to do refreshes when the M5Paper is not plugged in?
I want to use it as weather station. But it seems that I have to press the on button every time or let it permanently connected (see also https://github.com/Bastelschlumpf/M5PaperWeather/issues/1). Thanks in advance for the answers!
Does anyone know if it is possible to do refreshes when the M5Paper is not plugged in?
I want to use it as weather station. But it seems that I have to press the on button every time or let it permanently connected (see also Bastelschlumpf/M5PaperWeather#1). Thanks in advance for the answers!
Maybe this is an answer: https://github.com/Bastelschlumpf/M5PaperWeather/issues/1#issuecomment-1220284778 (not tested yet)
So I am very interested in this too, to use as a control panel stuck to my fridge (the M5Paper has a built-in magnet). In general it would be nice to see more support for eInk touch displays to make control panels with. BTW I tried to use a similar kit for this purpose, the Adafruit MagTag, but that (also a very nice kit) uses an ESP-S2... which is apparently not supported by ESPHome, another annoyance (this also sinks using these as BLE proxies, btw: ESP-S2's do not have bluetooth). I got an inkplate (which I have not tried setting up yet) but it's pretty basic (in particular, no battery, too big for the fridge) and the unit I got had no GPIO (parts shortage...). Overall the M5Stack still seems like one of the better options... if only it had a display driver, although I guess for battery operation a few other things probably also need to be sorted out.
My short term plan is to set up my M5Paper as an MQTT device (using either direct arduino programming or uiflow) but... ESPHome would be nicer, I have a bunch of other ESP devices set up that way already.
https://github.com/sebirdman/m5paper_esphome
Things are generally functional. There's some interesting changes that will have to happen to make the esphome spi component work with the display, so there's a forked version in this repo.
At some point, will work to get it upstreamed. If anyone wants to help, feel free to submit an MR
https://github.com/sebirdman/m5paper_esphome
Things are generally functional. There's some interesting changes that will have to happen to make the esphome spi component work with the display, so there's a forked version in this repo.
At some point, will work to get it upstreamed. If anyone wants to help, feel free to submit an MR
I see there is a fork of a fork of this here now: https://github.com/jesserockz/m5paper-esphome/ who forked from https://github.com/marcinkowalczyk/m5paper-esphome who forked from https://github.com/sebirdman/m5paper_esphome. Is this getting close to getting upstreamed? Anybody need any help testing? Are the SPI changes going to be blockers?
@jesserockz works for Nabu Casa so that's a good sign, probably :)
I've also been keeping a close eye and unfortunately changes in all 10 forks don't seem particularly significant from sebridman's.
That said, I've been able to get it to compile & work, however I had to hard code a bunch of stuff in IT8951ESensor::get_device_info. It seems like my device (nb: I have the "Community" edition with the semi-translucent case) returns garbage values for the screen H & W; the subsequent malloc calls end up crashing things as it tries to allocate way too much RAM. Has this happened to anyone else? It ends up causing a watchdog reset (until it falls back to ESPHome safe mode, anyway).
@k-w-1 I am having the same issue with the screen H & W values
When reading the device info from the M5Paper you have to do it slowly, so during initialisation the spi frequency needs to be lower, about 1MHz has been safe for me. After getting the device info you can ramp up to 10MHz (or even 20MHz iirc).
Shamelessly bumping this thread. Native M5Paper EspHome integration would be incredible!