hencou / esphome_components

Collection of own ESPhome components
25 stars 15 forks source link

Compiling for ESP32 #2

Closed ashp8i closed 2 years ago

ashp8i commented 2 years ago

is this code ready/doable for a ESP32?

hencou commented 2 years ago

It is only for ESP8266

Op do 23 dec. 2021 13:58 schreef ashp8i @.***>:

is this code ready/doable for a ESP32?

— Reply to this email directly, view it on GitHub https://github.com/hencou/esphome_components/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH3BQR35CNJF77LXIOASOPLUSMMFTANCNFSM5KUXLYTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

ashp8i commented 2 years ago

please close issue if this is a huge effort to support esp32

hencou commented 2 years ago

Hi,

Seems possible. see example here: https://github.com/hencou/esphome_components/blob/main/example_milight_esp32.yaml I have no ESP32 to test with, but compiling fine.

ashp8i commented 2 years ago

Thanks for trying to test with ESP32 setup, I do have both modules, however have issues with getting the code to compile in ESPHome 2021.12.1.

I get the following below: -

src/esphome/components/mi/mi.cpp: In member function 'virtual void esphome::mi::Mi::setup()': src/esphome/components/mi/mi.cpp:258:7: error: 'SPIFFS' was not declared in this scope SPIFFS.begin(); ^ *** [/data/mitest/.pioenvs/mitest/src/esphome/components/mi/mi.cpp.o] Error 1 ========================= [FAILED] Took 49.44 seconds =========================

copied your repo to esphome folder and tried to compile the example, esp8266 works no issues

hencou commented 2 years ago

Maybe you are using an old version of the libraries? Please clean the directory "/config/esphome/.esphome/external_components", then new versions of the files are retrieved from Github. And please replace the "milight" folder in the root of your esphome folder with the latest version from Github.

ashp8i commented 2 years ago

no sure what I'm doing wrong keep getting: -

Compiling /data/mitest/.pioenvs/mitest/src/MyMiLight.cpp.o In file included from src/esphome.h:19:0, from src/MyMiLight.cpp:1: src/esphome/components/json/json_util.h:27:46: error: 'ArduinoJson::Internals' has not been declared class VectorJsonBuffer : public ArduinoJson::Internals::JsonBufferBase<VectorJsonBuffer> { ^ src/esphome/components/json/json_util.h:27:57: error: expected '{' before 'JsonBufferBase' class VectorJsonBuffer : public ArduinoJson::Internals::JsonBufferBase<VectorJsonBuffer> { ^ src/esphome/components/json/json_util.h:27:71: error: expected initializer before '<' token class VectorJsonBuffer : public ArduinoJson::Internals::JsonBufferBase<VectorJsonBuffer> { ^ src/MyMiLight.cpp:484:1: error: expected '}' at end of input } ^ src/MyMiLight.cpp:484:1: error: expected '}' at end of input *** [/data/mitest/.pioenvs/mitest/src/MyMiLight.cpp.o] Error 1 ========================== [FAILED] Took 7.16 seconds ==========================

Kind Regards, Ash

ashp8i commented 2 years ago

I think I've caught it: -

|-- <ArduinoJson> 6.18.5 |-- <WiFi> 1.0 |-- <Update> 1.0 |-- <ESPAsyncWebServer-esphome> 2.1.0 | |-- <AsyncTCP-esphome> 1.2.2 |-- <DNSServer> 1.1.0 |-- <ArduinoJson-esphomelib> 5.13.3

ArduinoJson-esphomelib is v5.13.3

where as ArduinoJson is v6.18.5.

This causes breaking changes, I can see your code is using the newer ArduinoJson (bblanchon/ArduinoJson) which is v6.18.5 28 sep 2021

is it normal for using wrong libraries to introduce formatting errors? which the error: 'ArduinoJson::Internals' indicates

how do I force it to use newer version of libraries

ashp8i commented 2 years ago

zapped esphome, restoring older version esphome 2021.12.0 to test which seems to be going fine, holding out on esphome 2021.12.1 for now that selects wrong library also enabling web server makes it default to older library

I can confirm this is the case, when I avoid enabling webserver it compiles fine

ashp8i commented 2 years ago

Hi,

Seems possible. see example here: https://github.com/hencou/esphome_components/blob/main/example_milight_esp32.yaml I have no ESP32 to test with, but compiling fine.

This works therefore I can compile, now testing