esphome / issues

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

Crash on http_request.get #3441

Open behnam85 opened 2 years ago

behnam85 commented 2 years ago

The problem

The device crashes when call http_request component .

Which version of ESPHome has the issue?

2022.6.2

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2022.5.3

What platform are you using?

ESP32

Board

wemos 32

Component causing the issue

http_request

Example YAML snippet

esphome:
  name: nfc

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
http_request:
  useragent: esphome/device
  timeout: 15s 
web_server:
  port: 80  
  auth:
    username: admin
    password: admin

# Enable Home Assistant API
api:

ota:
  password: "c26e8dacc00237c50d170ffb3f24e120"

wifi:
  ssid: Mi wifi
  password: behnam123

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Nfc Fallback Hotspot"
    password: "Br9hto7sU50G"

captive_portal:

# Example configuration entry
uart:
  baud_rate: 9600
  tx_pin: 22
  rx_pin: 21
  rx_buffer_size: 512
spi:
  clk_pin: 18
  mosi_pin: 19
  miso_pin: 23

output:
  - platform: ledc
    pin:
      number: 16
      inverted: true
    id: rtttl_out

rtttl:
  output: rtttl_out  

sim800l:
  on_sms_received:
    - logger.log:
        format: "Received '%s' from %s"
        args: [ 'message.c_str()', 'sender.c_str()' ]

sensor:
  - platform: sim800l
    rssi:
      name: "Sim800L RSSI"

pn532_spi:
  cs_pin: 5
  update_interval: 1s  
  id: pn532_board
  on_tag:
   then: 

     - rtttl.play: 'two short:d=4,o=5,b=100:16e6,16e6'
     - delay: 2s
     - sim800l.send_sms:
         recipient: !lambda |-
           if (id(behnam).state) return "+126397436";
           if (id(mohamad).state) return "+149935646";
           if (id(farzane).state) return "+49935646";
           else return "26397436";
         message: !lambda |-
           if (id(behnam).state) return "behnam galdi";
           if (id(mohamad).state) return "mohamad galdi";
           if (id(farzane).state) return "farzane galdi";
           else return  "Hey new nfc card ";
     - delay: 5s     
     - http_request.get:
               verify_ssl: false 
               url: !lambda |-
                  char data[400];
                  sprintf(data , "UniqueID=%s" ,   id(template_text).state.c_str()  );
                  return ((std::string) "https://script.google.com/macros/s/2Ge4UPC0TEs_KXsU9wrHUyBUCDq9Q1TbVb2zHpul75QKt/exec?"  + data ).c_str(); 
               headers:
                    Content-Type: application/json

               on_response:
                   then:
                   - logger.log:
                       format: 'Response status: %d'
                       args:
                        - status_code

text_sensor:
  - platform: template
    name: "template text sensor"
    id: template_text

binary_sensor:
  - platform: sim800l
    registered:
      name: "Sim800L Registered"

  - platform: pn532
    uid: 2A-69-D2-1E
    name: "PN532 NFC Tag"
    id: behnam
    on_state:
     - text_sensor.template.publish:
        id: template_text
        state: "behnam_fahimifar"

  - platform: pn532
    uid: 0C-7C-56-D9
    name: "PN532 NFC Tag mohamad"
    id: mohamad  
    on_state:
       - text_sensor.template.publish:
          id: template_text
          state: "mohamad_fahimifar"

  - platform: pn532
    uid: BE-CB-12-5B
    name: "PN532 NFC Tag farzane"
    id: farzane    
    on_state:
     - text_sensor.template.publish:
        id: template_text
        state: "farzaneh_fahimifar"

Anything in the logs that might be useful for us?

No response

Additional information

No response

github-actions[bot] commented 1 year 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.

ssieb commented 1 year ago

Does "crash" mean it reboots? You need to provide serial logs. Does it still crash if you give it a fixed string instead of that strange combining you're doing?