feature-requests icon indicating copy to clipboard operation
feature-requests copied to clipboard

M5Paper support

Open megawubs opened this issue 3 years ago • 22 comments

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.

image

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.

megawubs avatar Jan 12 '21 06:01 megawubs

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.

megawubs avatar Jan 13 '21 09:01 megawubs

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

tallnhairydave avatar Jan 14 '21 11:01 tallnhairydave

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.

megawubs avatar Jan 17 '21 20:01 megawubs

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.

cyrilpawelko avatar Jan 21 '21 22:01 cyrilpawelko

@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 avatar Jan 22 '21 19:01 fonix232

@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 avatar Jan 24 '21 12:01 megawubs

@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 avatar Jan 28 '21 04:01 jhoult

@jhoult I'm not seeing it when I open UIFlow 1.7.2 beta :(

image

megawubs avatar Jan 28 '21 11:01 megawubs

Would also love to see the M5Paper supported by esphome.

sj3fk3 avatar Feb 06 '21 08:02 sj3fk3

Following as I'd love some support here.

eecue avatar Apr 07 '21 01:04 eecue

+1 to this, so I can use home assistant with this.

JasonSwindle avatar Apr 13 '21 22:04 JasonSwindle

Have a few m5papers here, but haven't started yet as it is not on my top priority list....

https://github.com/richardklingler/esphome

richardklingler avatar May 17 '21 11:05 richardklingler

I'd add my support for this too

HElkhoury avatar Aug 01 '21 14:08 HElkhoury

Same here. M5Paper seems like a perfect fit for esphome.

jravetch avatar Sep 09 '21 03:09 jravetch

Agreed, this would fill a lot of different use cases for me if it were running esphome.

virtualducttape avatar Oct 19 '21 16:10 virtualducttape

This would be a great addition to home assistant.

ngelotte avatar Nov 23 '21 22:11 ngelotte

m5paper push ... ;) would like to use the m5paper as a remote would be perfekt for this

Lexorius avatar Jan 20 '22 21:01 Lexorius

Such a neat looking device. Support would be great!

teun95 avatar Mar 18 '22 13:03 teun95

is there something new ? (push - again, because the device is realy nice)

Lexorius avatar Apr 17 '22 18:04 Lexorius

+1, would be great!

superinj avatar May 09 '22 23:05 superinj

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.

sebirdman avatar Aug 11 '22 01:08 sebirdman

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!

Yoneo avatar Aug 13 '22 09:08 Yoneo

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)

Yoneo avatar Sep 03 '22 17:09 Yoneo

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.

mmccool avatar Sep 09 '22 12:09 mmccool

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

sebirdman avatar Sep 10 '22 03:09 sebirdman

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 :)

mmccool avatar Mar 27 '23 16:03 mmccool

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 avatar Mar 30 '23 20:03 k-w-1

@k-w-1 I am having the same issue with the screen H & W values

error33-priv avatar Jul 26 '23 20:07 error33-priv

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).

Dominaezzz avatar Aug 15 '23 08:08 Dominaezzz

Shamelessly bumping this thread. Native M5Paper EspHome integration would be incredible!

AndBu avatar Oct 29 '23 14:10 AndBu