emsesp / EMS-ESP32

ESP32 firmware to read and control EMS and Heatronic compatible equipment such as boilers, thermostats, solar modules, and heat pumps
https://emsesp.github.io/docs
GNU Lesser General Public License v3.0
627 stars 107 forks source link

Upgrade to ESP32 - Wemos S2/C3 mini and S3 #605

Closed CheeseE closed 1 year ago

CheeseE commented 2 years ago

Question Has anyone tried this or this board to upgrade the old ESP8266 to ESP32? Is it pin-to-pin compatible with the D1 mini? It seems to me but it would be good for someone to confirm, thanks.

MichaelDvP commented 1 year ago

Yes, S3 is working good, i have 2 gateways connected MH-ET and S3. C3 was also good, but not tested with the latest 3.6. With S2 i remember that memory was a bit critical, but maybe this was also the stack overflow from NTP service. My S2-tests are long time ago. We can reopen for S2 if someone use it an report issues.

CheeseE commented 1 year ago

Before we close, can we add the bin files to the release, so people can use them without compiling the whole stuff?

bbqkees commented 1 year ago

Well maybe now is a good time to start offering a bin file for S3 on the repository.

bbqkees commented 1 year ago

@CheeseE Seems we had the same idea at the same time :-)

tp1de commented 1 year ago

Same for me. Bin files for S3 would be fine. Is there any chance to provide old version bin files in the repository as well?

MichaelDvP commented 1 year ago

Github actions has a issue for S3 with default platform, giving Error: Could not find the package with 'espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch3' requirements for your system 'linux_x86_64' The dev-platform 8.4.0+2021r2-patch5 works, so use this for the dev-builds? The S3 boardprofile defaults to the lilgo pinout.

MichaelDvP commented 1 year ago

Tested the S2 again with actual v3.6dev.

proddy commented 1 year ago

Tested the S2 again with actual v3.6dev.

  • Because of low heap mqtt is not working, we should check for PSRAM and heap to make it work again. But with HA enabled still ~20 mqtt errors happen while publishing the config.

Do you know what is causing the mqtt errors? Is it because of the heap check we added? I've been looking into https://github.com/bertmelis/espMqttClient which is new version of asyncMqttClient from one of the maintainers. It looks more lightweight and we can probably not use async and just send out the messages immediately because of the ESP32's dual core. I'm not sure though.

  • I get some TX-read errors independend of tx-mode. After a tx-read it receives a poll and then the answer, If i ignore this poll when waiting for reply, all is well (zero tx-errors). The liligo S3 also shows this, but not as often as S2.

Good catch. We can add that code to ignore it.

Also, do you think it's worth investing time into making EMS-ESP work on an S2?

MichaelDvP commented 1 year ago

Do you know what is causing the mqtt errors?

Yes, mostly. The async-mqtt also checks for free heap (4k) and gives message id 0 back if lower. For the HA messages we can change the mqtt publish functions to bool, checking the message-Id and resend later if not sent. (Our heap check is 60k and has to be disabled for psram present, otherwise the s2 never sends)

I've been looking into https://github.com/bertmelis/espMqttClient which is new version of asyncMqttClient from one of the maintainers. It looks more lightweight and we can probably not use async and just send out the messages immediately because of the ESP32's dual core. I'm not sure though.

looks nice. Also the current async-mqtt has a queue and processes qos, works also direct sending. The ems-esp queue is only usefull to queue before connected. But the new lib looks good. We should test it.

Also, do you think it's worth investing time into making EMS-ESP work on an S2?

No. But it's a nice test to see what happens if heap gets low and PSRam is active. Should be possible to make it stable.

CheeseE commented 1 year ago

@MichaelDvP could we add C3 binaries as well? I'm using that one for months now without issues.

MichaelDvP commented 1 year ago

The C3 works good, has more ram than S2 and with reduced tx-power buspowernig is possible. The Wemos C3 mini fits in the old gateway premium. It has only 4MB flash, but asymetric partitions with loader work.

But there are different versions of the wemos, v1.0.0 needs a special wifi init and have a single LED, v2.1.0 has a programable RGB-LED. So we need different binaries. I think it's better to compile yourself, or forc the repo and edit the github action to build your version.

@proddy what do you think about adding C3 bnary?

proddy commented 1 year ago

agree to make special instructions on how to adjust for C3

bbqkees commented 1 year ago

I'll add an update to my wiki soon with instruction on selecting the correct bin file.

MichaelDvP commented 1 year ago

Just an update to modules: Wemos/lolin have introduced a S3 mini https://www.wemos.cc/en/latest/s3/s3_mini.html with 4MB Flash and 2 MB PSRAM. But the lolin store is shut down https://lolin.aliexpress.com/ and the module can not be purcased https://de.aliexpress.com/item/1005005449219195.html Same for the C3 mini https://de.aliexpress.com/item/1005004740051202.html and S2, only S2 module is offered by different sellers on aliexpress. But S2 is to low with ram. The liligo S3 module is available in liligo shop again https://www.lilygo.cc/products/t7-s3. Price is lower now, but no tax handling by lilgo for EU customers. On ebay the module is still 23-27€ from chinese resellers.

proddy commented 1 year ago

Thanks for sharing. Hopefully bbqkees has enough S3's in stock for his next batch of gateway boards. Then next I'd love to play with the C6 with its fast RISC-V and WiFi6 support.