esphome / issues

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

repeat action in http_request.get on_response handler fails to compile #5987

Open iyzana opened 5 months ago

iyzana commented 5 months ago

The problem

The repeat action can't be used inside the http_request on_response handler anymore because of a compile failure.

This is a regression from 2024.6.2 and the first bad commit is https://github.com/esphome/esphome/commit/0179358f9cbb212d30627999a2f7233ff18e12ea

Which version of ESPHome has the issue?

2024.6.3+

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

No response

What platform are you using?

ESP8266

Board

d1_mini

Component causing the issue

http_request

Example YAML snippet

esphome:
  name: reproduce
  platform: ESP8266
  board: d1_mini
  on_boot:
    - priority: -100
      then:
        - http_request.get:
            url: "https://esphome.io/"
            on_response:
              then:
                - repeat:
                    count: 3
                    then:

wifi:
  ssid: "abcdefgh"
  password: "12345678"

http_request:
  useragent: esphome
  timeout: 2s
  id: http_request_data
  verify_ssl: false

Anything in the logs that might be useful for us?

src/main.cpp: In function 'void setup()':
src/main.cpp:149:99: error: use of deleted function 'esphome::RepeatAction<std::shared_ptr<esphome::http_request::HttpContainer>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>::RepeatAction()'
  149 |   repeataction_id = new RepeatAction<std::shared_ptr<http_request::HttpContainer>, std::string &>();
      |                                                                                                   ^
In file included from src/esphome.h:18,
                 from src/main.cpp:3:
src/esphome/core/base_automation.h:273:32: note: 'esphome::RepeatAction<std::shared_ptr<esphome::http_request::HttpContainer>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>::RepeatAction()' is implicitly deleted because the default definition would be ill-formed:
  273 | template<typename... Ts> class RepeatAction : public Action<Ts...> {
      |                                ^~~~~~~~~~~~
src/esphome/core/base_automation.h:273:32: error: no matching function for call to 'std::tuple<std::shared_ptr<esphome::http_request::HttpContainer>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>::tuple()'
In file included from /home/me/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/functional:54,
                 from /home/me/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/pstl/glue_algorithm_defs.h:13,
                 from /home/me/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/algorithm:74,
                 from /home/me/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:229,
                 from src/esphome/components/esp8266/gpio.h:6,
                 from src/esphome.h:4,
                 from src/main.cpp:3:

Additional information

0179358f9cbb212d30627999a2f7233ff18e12ea is the first bad commit commit 0179358f9cbb212d30627999a2f7233ff18e12ea

Improve 'body' handling in http_request on_response triggers (#6968)

esphome/codegen.py | 1 + esphome/components/http_request/init.py | 2 +- esphome/components/http_request/http_request.h | 19 ++++++++++++++----- esphome/cpp_types.py | 1 + 4 files changed, 17 insertions(+), 6 deletions(-)

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

iyzana commented 3 weeks ago

This still fails with the same output in version 2024.10.2