homieiot / homie-esp8266

💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT
http://homieiot.github.io/homie-esp8266
MIT License
1.36k stars 308 forks source link

Support ESP32 #415

Closed theinein closed 5 years ago

theinein commented 6 years ago

When do you plan to add support for ESP32 in Homie? I’m willing to contribute if I can find the time, but would need to understand what changes need to be made to Homie.

bertmelis commented 6 years ago
  1. async tcp library: see https://github.com/me-no-dev/AsyncTCP
  2. check what it takes to get https://github.com/marvinroger/async-mqtt-client compatible with point 1.
  3. check what it takes to make Homie compatible with point 2
apo-mak commented 6 years ago

there is a similar topic here https://github.com/marvinroger/homie-esp8266/issues/353

i will also love to see and help with support for esp32 on homie. Because i have upgrade most of my esp from 8266 to 32 an i cant use homie any more

bertmelis commented 6 years ago

Let's first try to make the asyncmqtt compatible. Then a ticker lib (requires some FreeRTOS knowledge). For the ticker, me-no-dev also did some work for it, but not yet release-ready. You could replace this by a millis()-polling design meanwhile. Homie's code itself is largely generic.

bertmelis commented 6 years ago

another roadblock: there's no webserver yet for the ESP32. So config-mode is not working. There's a ticket for at the Arduino-esp32-repo and as I understand we'll have to wait for a seperate repo for a (async?) webserver compatible with both esp8266 and esp32. Once it's there we can a have another look at it.

Anyway, an eventual esp32 implementation should belong in it's own repo as it is another implementation ,which will be largely the same but not quite.

see also: https://github.com/marvinroger/async-mqtt-client/issues/62

theinein commented 6 years ago

Thanks for all the great discussion. Clearly larger than I thought.

timpur commented 6 years ago

It would be nice to start working on these issues :)

timpur commented 6 years ago

@bertmelis Why doesn't homie use ESPAsyncWebServer ?? Works for both esp32 and esp8266 ??

bertmelis commented 6 years ago

I didn't know it was already available. It's on @marvinroger 's to do list I think.

But again, the esp32 version should belong in it's own repo IHMO. Now the codebase is still largely the same but maybe it will not be the case eventually (TLS/SSL for example).

timpur commented 6 years ago

No i totally agree, it should be in a different repo !!! (most definitely should be).

Just thinking if homie was changed to use ESPAsyncWebServer then porting homie to esp32 would be that much easier. Additionally it makes sense to use async where possible.

We should try keep the same featured for both.

timpur commented 6 years ago

I have moved homie over to AsyncWebServer. https://github.com/timpur/homie-esp8266. Still testing and fixing up doc related stuff. When done ill make a pull request

@marvinroger hope you think this is the right progress for homie.

bertmelis commented 6 years ago

is _sendCROS() a typo? Did you mean CORS or is it on purpose?

timpur commented 6 years ago

shoot, yeah my bad ill fix up.

Edit: Done

bertmelis commented 6 years ago

@timpur: you did the changes on the develop branch right? (so I clone the right repo)

BTW moving the asyncwebserver is definitely the right move. I think marvin already had it on his todo-list.

timpur commented 6 years ago

Yep all on the dev branch. I was going to test more before making a Pull request?

Also i might have some time to implement the new homie v3.0 (redesign branch) which is close to release... just not sure if i should wait for marvin to actually release v3.0 since the spec might change ... ?

see i want to get homie-esp8266 up to date before cloning for esp32 so we dont have to implement the new changes separately in both projects....

timpur commented 6 years ago

@bertmelis @tripflex News !!!! Last night at 1am (for me), i successfully ported the Homie to the esp32, Since it was so late for me i havnt commited any code, as i want to fix up, what is propably quite dogy code (beeing done at 1am....). Inital tests at 1am show that all seems to work as you'd expect. Still some stablity issues that need ironing out, but had the config mode work with the ui, and could successfully connect to mqtt... so a good start. Will do some cleaning up over the weekend and need to push some things to ESP32 Arduino that was missing, but im exited .....

There acutally wernt that many changes need to port homie over (more a couple of esentials from the arduino framwork), this begs the question, can we have one port for both esp8266 and esp32 ? This woiuld make mangaing code easier .... lets discus.

ESP32 here we come :)

timpur commented 6 years ago

Update, done some testing and things seem quite stable. A couple of minor glitches but only in config mode...

Will try to fix and get it ready for you guys to play with :)

nicola-lunghi commented 6 years ago

https://github.com/craftmetrics/esp32-homie

timpur commented 6 years ago

Arduino for esp32 PR is in (https://github.com/espressif/arduino-esp32/pull/1366#event-1624524337), which means you can now use https://github.com/timpur/homie-esp8266/tree/esp32 (i know its a branch atm, will be moved out into its own repo soon)

For Arduino IDE just use the latest clone of the https://github.com/espressif/arduino-esp32 repo

For PlatformIO use:

[env:ESP32]
platform = https://github.com/platformio/platform-espressif32.git#feature/stage
framework = arduino
board = esp32doit-devkit-v1
upload_speed = 921600
monitor_baud = 115200

Have a play (dont expect it to be stable yet) :)

maurostaiti commented 6 years ago

Hi Timpur

thanks for your work

today i'm tryng to compile an homie example for esp32 , but the errors are

Edit by timpur: large stack trace was here...

I'm using this https://github.com/timpur/homie-esp8266/tree/esp32 and this https://github.com/espressif/arduino-esp32 thanks in advance!

timpur commented 6 years ago

@maurostaiti and everyone else, so sorry i some how forgot to push my changes to the esp32 branch ... awks.

@maurostaiti, as your comment contains a long stack trace im going to remove, please repost if you have anymore issues.

@tripflex, this might also solve your issue :P

maurostaiti commented 6 years ago

Hi Tim Please ignore my previous post. i've managet to solve them , was my json lib out of date.

thanks for your hard work Mauro

justClouds commented 5 years ago

Any updates on the status of the ESP32 implementation? I noticed the https://github.com/timpur/homie-esp8266/tree/esp32 branch hasn't been updated since May, so just wondering if it is still maintained?

timpur commented 5 years ago

sadly not, im no longer really working on this project sadly, hopefully some one will like to pick it up ?

dmartinpro commented 5 years ago

Also really/very interested in ESP32 support as an ESP32 board makes more sense now than a less versatile ESP8266 board. Is it possible to merge the Timpur's work once for all or is there any blocking things here and there? Could be really terrific to have Homie 2.0/3.0 on these boards.

euphi commented 5 years ago

The #develop-v3 branch supports ESP32 since some days.

euphi commented 5 years ago

The develop-v3 branch supports the convention 3.0.1. The convention is not completely backward-compatible, but for almost all relevant usecases. There are also some API changes in the homie-esp8266 implementation. However, it is already quite stable, so you can give it a try.

lorenwest commented 5 years ago

As a major version change, maybe it's time to merge into master?

mike-yesware commented 5 years ago

I've been lurking here meaning to post a question like @lorenwest's for a while. Seems like:

TBH, the last two are most confusing to me as it seems like homie-esp8266 should be versioned itself, and it also wants to support two different versions of the Homie spec. At least, I think that's the current intention of the two branches.

Would there be interest in stable-v2 and a stable-v3 (or, just master) branches that releases can be cut from? I'm quite happy to help with any of the release engineering work if that's agreeable.

Please let me know if I've gotten any of this wrong

lorenwest commented 5 years ago

@mike-yesware Thanks for bringing this up. While I don't have a ton of time to invest in this I'd be happy to work with you as another pair of eyes, and to help with validation.

mike-yesware commented 5 years ago

Actually, my comment feels like a hijack of this thread, so I moved it to: https://github.com/homieiot/homie-esp8266/issues/587