esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 36 forks source link

Custom component won't compile on new HA build #5092

Closed greenbeast999 closed 11 months ago

greenbeast999 commented 11 months ago

The problem

I've got a custom component for a split AC unit i have. I was able to compile in windows a few months back but had trouble adding it to HA so dropped the project for a bit, i had to get a RPI4 to have enough memory to compile directly from HA but now i have 2-3 errors compiling. Suspect something has changed in the newer version of ESPHome but i'm not good enough to figure out what.

Many thanks

Which version of ESPHome has the issue?

2023.10.6

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.10.5

What platform are you using?

ESP8266

Board

OEM split AC board

Component causing the issue

No response

Example YAML snippet

esphome:
  name: electriq-12000-ac
  includes:
    - electriq_ac.h

esp8266:
  board: esp01_1m

# Enable logging (and disable DEBUG)
logger:
  level: INFO

# Enable Home Assistant API
api:

ota:
  password: "SET_BY_HOME_ASSISTANT"

wifi:
  ssid: Nick
  password: MYWIFI7855

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Electriq-12000-Ac-1"
    password: "SET_BY_HOME_ASSISTANT"

captive_portal:

uart:
  id: uart_bus
  rx_pin: GPIO13
  tx_pin: GPIO15
  baud_rate: 9600

climate:
  - platform: custom
    lambda: |-
      auto electriqac = new ElectriqAC(id(uart_bus));
      App.register_component(electriqac);
      return {electriqac};
    climates:
      - id: electriqac
      - name: "Electriq 12000 AC 1"
# overrun automation below here. This is optional but recommended.
        on_state:
          - delay: 2s
          - if:
              condition:
                lambda: 'return ((id(electriqac).action == CLIMATE_ACTION_IDLE) && (id(electriqac).mode == CLIMATE_MODE_HEAT) && !id(overrun));'
              then:
                - globals.set:
                    id: 'overrun'
                    value: 'true'
                - logger.log: "Overrun fan mode, waiting 30s"
                - climate.control:
                    id: 'electriqac'
                    mode: FAN_ONLY
                - delay: 30s
                - if:
                    condition:
                      lambda: 'return (id(electriqac).action == CLIMATE_ACTION_FAN);'
                    then:
                      - logger.log: "Overrun finished, reverting to heat mode"
                      - climate.control:
                          id: 'electriqac'
                          mode: HEAT
          - if:
              condition:
                lambda: 'return ((id(electriqac).action == CLIMATE_ACTION_HEATING) && id(overrun));'
              then:
               - logger.log: "Resetting overrun"
               - globals.set:
                    id: 'overrun'
                    value: 'false'

globals:
  - id: overrun
    type: bool
    initial_value: 'true'

Anything in the logs that might be useful for us?

INFO ESPHome 2023.10.6
INFO Reading configuration /config/esphome/bedroom-ac.yaml...
INFO Generating C++ source...
INFO Core config or version changed, cleaning build files...
INFO Compiling app...
Processing electriq-12000-ac (board: esp01_1m; framework: arduino; platform: platformio/espressif8266@3.2.0)
--------------------------------------------------------------------------------
Platform Manager: Installing platformio/espressif8266 @ 3.2.0
INFO Installing platformio/espressif8266 @ 3.2.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Platform Manager: espressif8266@3.2.0 has been installed!
INFO espressif8266@3.2.0 has been installed!
Tool Manager: Installing platformio/toolchain-xtensa @ ~2.100300.0
INFO Installing platformio/toolchain-xtensa @ ~2.100300.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: toolchain-xtensa@2.100300.220621 has been installed!
INFO toolchain-xtensa@2.100300.220621 has been installed!
Tool Manager: Installing platformio/framework-arduinoespressif8266 @ ~3.30002.0
INFO Installing platformio/framework-arduinoespressif8266 @ ~3.30002.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: framework-arduinoespressif8266@3.30002.0 has been installed!
INFO framework-arduinoespressif8266@3.30002.0 has been installed!
Tool Manager: Installing platformio/tool-esptool @ <2
INFO Installing platformio/tool-esptool @ <2
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: tool-esptool@1.413.0 has been installed!
INFO tool-esptool@1.413.0 has been installed!
Tool Manager: Installing platformio/tool-esptoolpy @ ~1.30000.0
INFO Installing platformio/tool-esptoolpy @ ~1.30000.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: tool-esptoolpy@1.30000.201119 has been installed!
INFO tool-esptoolpy@1.30000.201119 has been installed!
Library Manager: Installing esphome/ESPAsyncTCP-esphome @ 2.0.0
INFO Installing esphome/ESPAsyncTCP-esphome @ 2.0.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Library Manager: ESPAsyncTCP-esphome@2.0.0 has been installed!
INFO ESPAsyncTCP-esphome@2.0.0 has been installed!
Library Manager: Installing esphome/ESPAsyncWebServer-esphome @ 3.1.0
INFO Installing esphome/ESPAsyncWebServer-esphome @ 3.1.0
Unpacking  [####################################]  100%
Library Manager: ESPAsyncWebServer-esphome@3.1.0 has been installed!
INFO ESPAsyncWebServer-esphome@3.1.0 has been installed!
Library Manager: Resolving dependencies...
INFO Resolving dependencies...
Library Manager: Installing ottowinter/ESPAsyncTCP-esphome
INFO Installing ottowinter/ESPAsyncTCP-esphome
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Library Manager: ESPAsyncTCP-esphome@1.2.3 has been installed!
INFO ESPAsyncTCP-esphome@1.2.3 has been installed!
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.1.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/api/api_connection.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/api/api_frame_helper.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/api/api_pb2.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/api/api_pb2_service.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/api/api_server.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/api/list_entities.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/api/proto.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/api/subscribe_state.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/api/user_services.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/captive_portal/captive_portal.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/climate/climate.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/climate/climate_mode.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/climate/climate_traits.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/esp8266/core.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/esp8266/gpio.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/esp8266/preferences.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/logger/logger.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/md5/md5.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/mdns/mdns_component.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/mdns/mdns_esp32.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/mdns/mdns_esp8266.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/mdns/mdns_host.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/mdns/mdns_libretiny.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/mdns/mdns_rp2040.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/network/util.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/ota/ota_backend_arduino_esp32.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/ota/ota_backend_arduino_esp8266.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/ota/ota_backend_arduino_libretiny.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/ota/ota_backend_arduino_rp2040.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/ota/ota_backend_esp_idf.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/ota/ota_component.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/socket/bsd_sockets_impl.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/socket/lwip_raw_tcp_impl.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/socket/lwip_sockets_impl.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/socket/socket.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/uart/uart.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/uart/uart_component.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/uart/uart_component_esp32_arduino.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/uart/uart_component_esp8266.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/uart/uart_component_esp_idf.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/uart/uart_component_libretiny.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/uart/uart_component_rp2040.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/uart/uart_debugger.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/web_server_base/web_server_base.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/wifi/wifi_component.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/wifi/wifi_component_esp32_arduino.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/wifi/wifi_component_esp8266.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/wifi/wifi_component_esp_idf.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/wifi/wifi_component_libretiny.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/components/wifi/wifi_component_pico_w.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/core/application.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/core/color.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/core/component.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/core/component_iterator.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/core/controller.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/core/entity_base.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/core/helpers.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/core/log.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/core/scheduler.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/core/string_ref.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/core/time.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/esphome/core/util.cpp.o
Compiling .pioenvs/electriq-12000-ac/src/main.cpp.o
Generating LD script .pioenvs/electriq-12000-ac/ld/local.eagle.app.v6.common.ld
Compiling .pioenvs/electriq-12000-ac/lib428/ESPAsyncTCP-esphome/AsyncPrinter.cpp.o
Compiling .pioenvs/electriq-12000-ac/lib428/ESPAsyncTCP-esphome/ESPAsyncTCP.cpp.o
Compiling .pioenvs/electriq-12000-ac/lib428/ESPAsyncTCP-esphome/ESPAsyncTCPbuffer.cpp.o
Compiling .pioenvs/electriq-12000-ac/lib428/ESPAsyncTCP-esphome/SyncClient.cpp.o
Compiling .pioenvs/electriq-12000-ac/lib428/ESPAsyncTCP-esphome/tcp_axtls.c.o
Compiling .pioenvs/electriq-12000-ac/libaf0/Hash/Hash.cpp.o
Compiling .pioenvs/electriq-12000-ac/lib67b/ESP8266WiFi/BearSSLHelpers.cpp.o
Archiving .pioenvs/electriq-12000-ac/libaf0/libHash.a
Compiling .pioenvs/electriq-12000-ac/lib67b/ESP8266WiFi/CertStoreBearSSL.cpp.o
In file included from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/pstl/glue_algorithm_defs.h:13,
                 from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/algorithm:74,
                 from src/esphome/core/optional.h:19,
                 from src/esphome/components/socket/socket.h:5,
                 from src/esphome/components/api/api_frame_helper.h:14,
                 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/functional: In instantiation of 'struct std::_Bind_helper<false, void (esphome::Action<esphome::climate::Climate&>::*)(esphome::climate::Climate&), esphome::DelayAction<esphome::climate::Climate&>*, esphome::climate::Climate&>':
/data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/functional:785:5:   required by substitution of 'template<class _Func, class ... _BoundArgs> typename std::_Bind_helper<std::__is_socketlike<_Func>::value, _Func, _BoundArgs ...>::type std::bind(_Func&&, _BoundArgs&& ...) [with _Func = void (esphome::Action<esphome::climate::Climate&>::*)(esphome::climate::Climate&); _BoundArgs = {esphome::DelayAction<esphome::climate::Climate&>*, esphome::climate::Climate&}]'
src/esphome/core/base_automation.h:135:23:   required from 'void esphome::DelayAction<Ts>::play_complex(Ts ...) [with Ts = {esphome::climate::Climate&}]'
src/esphome/core/base_automation.h:134:8:   required from here
/data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/functional:768:71: error: invalid abstract parameter type 'esphome::climate::Climate'
  768 |       typedef _Bind<__func_type(typename decay<_BoundArgs>::type...)> type;
      |                                                                       ^~~~
In file included from src/esphome/core/controller.h:29,
                 from src/esphome/components/api/api_server.h:9,
                 from src/esphome/components/api/api_connection.h:6,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
src/esphome/components/climate/climate.h:161:7: note:   because the following virtual functions are pure within 'esphome::climate::Climate':
  161 | class Climate : public EntityBase {
      |       ^~~~~~~
src/esphome/components/climate/climate.h:256:25: note:     'virtual esphome::climate::ClimateTraits esphome::climate::Climate::traits()'
  256 |   virtual ClimateTraits traits() = 0;
      |                         ^~~~~~
src/esphome/components/climate/climate.h:266:16: note:     'virtual void esphome::climate::Climate::control(const esphome::climate::ClimateCall&)'
  266 |   virtual void control(const ClimateCall &call) = 0;
      |                ^~~~~~~
In file included from src/esphome.h:55,
                 from src/main.cpp:3:
src/esphome/core/base_automation.h: In instantiation of 'void esphome::DelayAction<Ts>::play_complex(Ts ...) [with Ts = {esphome::climate::Climate&}]':
src/esphome/core/base_automation.h:134:8:   required from here
src/esphome/core/base_automation.h:135:23: error: no matching function for call to 'bind(void (esphome::Action<esphome::climate::Climate&>::*)(esphome::climate::Climate&), esphome::DelayAction<esphome::climate::Climate&>*, esphome::climate::Climate&)'
  135 |     auto f = std::bind(&DelayAction<Ts...>::play_next_, this, x...);
      |              ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/pstl/glue_algorithm_defs.h:13,
                 from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/algorithm:74,
                 from src/esphome/core/optional.h:19,
                 from src/esphome/components/socket/socket.h:5,
                 from src/esphome/components/api/api_frame_helper.h:14,
                 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/functional:785:5: note: candidate: 'template<class _Func, class ... _BoundArgs> typename std::_Bind_helper<std::__is_socketlike<_Func>::value, _Func, _BoundArgs ...>::type std::bind(_Func&&, _BoundArgs&& ...)'
  785 |     bind(_Func&& __f, _BoundArgs&&... __args)
      |     ^~~~
/data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/functional:785:5: note:   substitution of deduced template arguments resulted in errors seen above
/data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/functional:809:5: note: candidate: 'template<class _Result, class _Func, class ... _BoundArgs> typename std::_Bindres_helper<_Result, _Func, _BoundArgs>::type std::bind(_Func&&, _BoundArgs&& ...)'
  809 |     bind(_Func&& __f, _BoundArgs&&... __args)
      |     ^~~~
/data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/functional:809:5: note:   template argument deduction/substitution failed:
In file included from src/esphome.h:55,
                 from src/main.cpp:3:
src/esphome/core/base_automation.h:135:23: note:   couldn't deduce template parameter '_Result'
  135 |     auto f = std::bind(&DelayAction<Ts...>::play_next_, this, x...);
      |              ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** [.pioenvs/electriq-12000-ac/src/main.cpp.o] Error 1
========================= [FAILED] Took 206.61 seconds =========================

Additional information

No response

ssieb commented 11 months ago

Duplicate of https://github.com/esphome/issues/issues/5034

ssieb commented 11 months ago

But as mentioned in the other issue, you shouldn't have long delays in triggers anyway. Move it to a script.

greenbeast999 commented 11 months ago

Move it to a script.

Unfortunately this doesn't mean much to me, i mean i know what a script is, but i don't know enough about HA/ESPHome to do anything with that statement. Could you possibly elaborate for me?

ssieb commented 11 months ago

https://esphome.io/guides/automations#script-component If you need more help, then come ask on the esphome discord server.

greenbeast999 commented 11 months ago

Thanks i will have a read