jplitza / esphome_components

Custom-made components that I use for ESPHome.
GNU General Public License v3.0
11 stars 12 forks source link

Build Issues with ESPHome 2022.6.2 #8

Open mightea opened 2 years ago

mightea commented 2 years ago

I'm trying to integrate this component with a esp01_1m ESP8266 (Hichi IR WiFi) and I'm getting a build error. Are you able to build with the newest ESPHome version?

Processing esph-smart-meter (board: esp01_1m; framework: arduino; platform: platformio/espressif8266 @ 3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.3
|-- <ESPAsyncWebServer-esphome> 2.1.0
|   |-- <ESPAsyncTCP-esphome> 1.2.3
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|-- <DNSServer> 1.1.1
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
|-- <ArduinoJson> 6.18.5
Compiling /data/esph-smart-meter/.pioenvs/esph-smart-meter/src/main.cpp.o
Archiving /data/esph-smart-meter/.pioenvs/esph-smart-meter/libaf0/libHash.a
Compiling /data/esph-smart-meter/.pioenvs/esph-smart-meter/lib67b/ESP8266WiFi/ESP8266WiFi.cpp.o
Compiling /data/esph-smart-meter/.pioenvs/esph-smart-meter/lib67b/ESP8266WiFi/ESP8266WiFiAP.cpp.o
Compiling /data/esph-smart-meter/.pioenvs/esph-smart-meter/lib67b/ESP8266WiFi/ESP8266WiFiGeneric.cpp.o
Compiling /data/esph-smart-meter/.pioenvs/esph-smart-meter/lib67b/ESP8266WiFi/ESP8266WiFiGratuitous.cpp.o
Compiling /data/esph-smart-meter/.pioenvs/esph-smart-meter/lib67b/ESP8266WiFi/ESP8266WiFiMulti.cpp.o
Compiling /data/esph-smart-meter/.pioenvs/esph-smart-meter/lib67b/ESP8266WiFi/ESP8266WiFiSTA-WPS.cpp.o
Compiling /data/esph-smart-meter/.pioenvs/esph-smart-meter/lib67b/ESP8266WiFi/ESP8266WiFiSTA.cpp.o
/config/esphome/smart-meter.yaml: In function 'void setup()':
/config/esphome/smart-meter.yaml:67:56: error: reference to 'optional' is ambiguous
   67 | #       - uart.write:
      |                                                        ^       
In file included from src/esphome/core/component.h:7,
                 from src/esphome/components/api/api_connection.h:3,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
src/esphome/core/optional.h:36:28: note: candidates are: 'template<class T> class esphome::optional'
   36 | template<typename T> class optional {  // NOLINT
      |                            ^~~~~~~~
In file included from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/bits/node_handle.h:39,
                 from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/bits/hashtable.h:37,
                 from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/unordered_map:46,
                 from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/functional:61,
                 from src/esphome/core/component.h:4,
                 from src/esphome/components/api/api_connection.h:3,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
/data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/optional:60:11: note:                 'template<class _Tp> class std::optional'
   60 |     class optional;
      |           ^~~~~~~~
/config/esphome/smart-meter.yaml:67:64: error: expected '{' before '<' token
   67 | #       - uart.write:
      |                                                                ^
/config/esphome/smart-meter.yaml:67:65: error: expected primary-expression before 'float'
   67 | #       - uart.write:
      |                                                                 ^    
/config/esphome/./components/common/../sensors/wifi_signal_percentage.yaml:30:50: error: reference to 'optional' is ambiguous
In file included from src/esphome/core/component.h:7,
                 from src/esphome/components/api/api_connection.h:3,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
src/esphome/core/optional.h:36:28: note: candidates are: 'template<class T> class esphome::optional'
   36 | template<typename T> class optional {  // NOLINT
      |                            ^~~~~~~~
In file included from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/bits/node_handle.h:39,
                 from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/bits/hashtable.h:37,
                 from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/unordered_map:46,
                 from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/functional:61,
                 from src/esphome/core/component.h:4,
                 from src/esphome/components/api/api_connection.h:3,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
/data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/optional:60:11: note:                 'template<class _Tp> class std::optional'
   60 |     class optional;
      |           ^~~~~~~~
/config/esphome/./components/common/../sensors/wifi_signal_percentage.yaml:30:58: error: expected '{' before '<' token
/config/esphome/./components/common/../sensors/wifi_signal_percentage.yaml:30:59: error: expected primary-expression before 'float'
Compiling /data/esph-smart-meter/.pioenvs/esph-smart-meter/lib67b/ESP8266WiFi/ESP8266WiFiScan.cpp.o
Compiling /data/esph-smart-meter/.pioenvs/esph-smart-meter/lib67b/ESP8266WiFi/WiFiClient.cpp.o
*** [/data/esph-smart-meter/.pioenvs/esph-smart-meter/src/main.cpp.o] Error 1
========================= [FAILED] Took 18.65 seconds =========================

As soon as I remove the component everything builds fine. Any hints would be appreciated, thank you.

jplitza commented 1 year ago

Sorry for the very late response.

Yes, I just built the OBIS component successfully with the latest ESPhome.

Since the log is mentioning "optional", I suspect my syntax for inline comments in the example config is invalid: https://github.com/jplitza/esphome_components/blob/8d7bde643861b78b86a269862bccca292becb883/example_obis.yml#L16 Can you try to remove the # optional at the end of that line? If that doesn't work, please post your full config for further analysis.