esphome / issues

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

[ESP32-C3], DeepSleepComponent' has no member named 'set_ext1_wakeup', though esp32-c3 has rtc gpio #5773

Closed freeTheo closed 4 months ago

freeTheo commented 4 months ago

The problem

When I used the wakeup pin on the esp32-c3, the compilation times were wrong, Although the esp32-c3 does not have a touchpin, it can be awakened by raising the level on the gpio

Which version of ESPHome has the issue?

ESPHome 2024.4.0

What type of installation are you using?

Docker

Which version of Home Assistant has the issue?

null

What platform are you using?

ESP32

Board

esp32dev

Component causing the issue

deep-sleep

Example YAML snippet

esphome:
  name: "alpha-c3"
  friendly_name: "alpha-c3"

external_components:
  # - source: github://dentra/esphome-components
  - source:
      type: "local"
      path: "esphome-components/components"
    # components:
    #   - "alpha_charger"
  - source:
      type: git
      url: https://github.com/groothuisss/esphome-usb-powerdelivery.git
      ref: master
    components: fusb302

esp32:
  board: esp32-c3-devkitm-1
  variant: ESP32C3
  flash_size: 16MB
  framework:
    # platform_version: latest
    type: arduino
    version: latest
    # Custom sdkconfig options
    # sdkconfig_options:
    #   COMPILER_OPTIMIZATION_SIZE: y
    # Advanced tweaking options
    # advanced:
    #   ignore_efuse_mac_crc: false
# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:
  encryption:
    key: "Ns1WTKYtEWjYJCPjNbOGn0YZzp4wZTUMVPOrUFUJxAc="

ota:
  password: "6cb662d9c57ec855291b2f7ec8b3c552"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  # power_save_mode: none

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "alpha-light (12345678x)"
    password: "12345678x"

captive_portal:

web_server:
  port: 80
  # local: true
  version: 3
  # js_url: https://oi.esphome.io/v3/www.js

fusb302:
  maximum_supply_voltage: 15v # Change to the correct maximum supply voltage: [5v, 9v, 12v, 15v, 20v]
  interrupt_pin: GPIO8 # Change to the correct GPIOxx

bq25792:
    i2c_id: "bus_in"
    address: "0x6b"
    update_interval: 10s
    battery_level:
      name: "电池电量"

i2c:
  - id: 'bus_in'
    sda: GPIO5
    scl: GPIO6
    scan: true
    frequency: 400000
  # - id: bus_out
  #   sda: GPIO5
  #   scl: GPIO4
  #   scan: true
  #   frequency: 400

power_supply:
  - id: "power_supply_led"
    pin: GPIO7
    keep_on_time: 500ms

output:
  - platform: ledc
    pin: GPIO1
    id: "led_cold"
    power_supply: power_supply_led
    min_power: 0
    max_power: 0.8
  - platform: ledc
    pin: GPIO0
    id: "led_warm"
    power_supply: power_supply_led
  # - platform: ledc
  #   pin: GPIO1
  #   id: led_warm_1
  #   power_supply: power_supply_led
  # - platform: ledc
  #   pin: GPIO2
  #   id: led_warm_2
  #   power_supply: power_supply_led

  # - platform: ...
  #   id: my_output_id
  #   power_supply: power_supply_id
  #   inverted: false
  #   min_power: 0.01
  #   max_power: 0.75
# uart:
#   tx_pin: GPIO1
#   rx_pin: GPIO2
#   id: uart_1
#   baud_rate: 115200
  # debug:

# ld2420:
#     uart_id: uart_1  
# ld2410:
#     uart_id: uart_1  

light:
  - platform: monochromatic
    id: "light_1"
    name: "Livingroom Lights"
    output: "led_cold"
    restore_mode: RESTORE_DEFAULT_OFF
    effects:
      # Use default parameters:
      - random:
      # Customize parameters
      - random:
          name: "My Slow Random Effect"
          transition_length: 30s
          update_interval: 30s
      - random:
          name: "My Fast Random Effect"
          transition_length: 4s
          update_interval: 5s
  - platform: monochromatic
    id: "light_2"
    name: "flower"
    output: "led_warm"
    restore_mode: RESTORE_DEFAULT_OFF
    effects:
      # Use default parameters:
      - random:
      # Customize parameters
      - random:
          name: "My Slow Random Effect"
          transition_length: 30s
          update_interval: 30s
      - random:
          name: "My Fast Random Effect"
          transition_length: 4s
          update_interval: 5s

sensor:

    # power: power_id
    # voltage: voltage_id
    # current: current_id
    # apparent_power:
    #   name: "$name Apparent Power"
    # reactive_power:
    #   name: "$name Reactive Power"
    # power_factor:
    #   name: "$name Power Factor"
    # wait_time: 500

  # - platform: bh1750
  #   name: "BH1750 Illuminance"
  #   address: 0x23
  #   i2c_id: bus_a
  #   update_interval: 1s

  # - platform: adc
  #   pin: GPIO4
  #   raw: false
  #   name: "ADC Value"
  #   update_interval: 1s

  # - platform: ld2420
  #   moving_distance:
  #     name : Moving Distance

  # - platform: ld2410
  #   light:
  #     name: light
  #   moving_distance:
  #     name : Moving Distance
  #   still_distance:
  #     name: Still Distance
  #   moving_energy:
  #     name: Move Energy
  #   still_energy:
  #     name: Still Energy
  #   detection_distance:
  #     name: Detection Distance
  #   g0:
  #     move_energy:
  #       name: g0 move energy
  #     still_energy:
  #       name: g0 still energy
  #   g1:
  #     move_energy:
  #       name: g1 move energy
  #     still_energy:
  #       name: g1 still energy
  #   g2:
  #     move_energy:
  #       name: g2 move energy
  #     still_energy:
  #       name: g2 still energy
  #   g3:
  #     move_energy:
  #       name: g3 move energy
  #     still_energy:
  #       name: g3 still energy
  #   g4:
  #     move_energy:
  #       name: g4 move energy
  #     still_energy:
  #       name: g4 still energy
  #   g5:
  #     move_energy:
  #       name: g5 move energy
  #     still_energy:
  #       name: g5 still energy
  #   g6:
  #     move_energy:
  #       name: g6 move energy
  #     still_energy:
  #       name: g6 still energy
  #   g7:
  #     move_energy:
  #       name: g7 move energy
  #     still_energy:
  #       name: g7 still energy
  #   g8:
  #     move_energy:
  #       name: g8 move energy
  #     still_energy:
  #       name: g8 still energy

text_sensor:
  # - platform: ld2420
  #   fw_version:
  #     name: LD2420 Firmware
  # - platform: ld2410
  #   version:
  #     name: "firmware version"
    # mac_address:
    #   name: "mac address"

binary_sensor:
  # - platform: ld2420
  #   has_target:
  #     name: Presence
  - platform: gpio
    id: "motion_1"
    pin: 
      number: GPIO4
      mode:
        input: true
        pulldown: true
    name: "motion"
    device_class: motion
    # on_state:
    #     then:
    #       - lambda: |-
    #           if (!id(motion_1).state) {
    #             id(deep_sleep_1).enter;
    #           } else {
    #             id(deep_sleep_1).wakeup;
    #           }
          # - deep_sleep.enter: "deep_sleep_1"
  - platform: gpio
    id: "touch_pad_1"
    pin: GPIO10
    name: "touch"
    filters:
      - invert
    # on_click: 
    #   - min_length: 50ms
    #     max_length: 350ms
    #     then:
    #       - light.turn_on: 
    #           id: "light_1"
      # - min_length: 2000ms
      #   max_length: 4000ms
      #   then:
      #     - light.turn_off: "light_1"
    on_multi_click:
    - timing:
        - ON for at most 1s
        - OFF for at most 1s
        - ON for at most 1s
        - OFF for at least 0.5s
      then:
        - light.turn_off: "light_1"
        - light.turn_off: "light_2"
        # - logger.log: "Double Clicked"
    - timing: 
        - ON for at most 1s
        - OFF for at least 0.5s
      then:
        - light.turn_on: "light_1"
        - light.turn_on: "light_2"
    - timing:
        - ON for at most 1s
        - OFF for at most 1s
        - ON for at most 1s
        - OFF for at most 1s
        - ON for at most 1s
        - OFF for at most 1s
        - ON for at most 1s
        - OFF for at most 1s
        - ON for at most 1s
        - OFF for at least 0.5s
      then:
        - deep_sleep.enter: "deep_sleep_manual"
    # on_double_click: 
    #   - min_length: 100ms
    #     max_length: 350ms
    #     then:
    #       - light.turn_off: "light_1"

    # on_press:
    #   - delay: 1000ms
    #   - while:
    #       condition:
    #         - light.is_on: "light_1"
    #         - light.is_on: "light_2"
    #         - binary_sensor.is_on: "touch_pad_1"
    #       then:
    #         - light.dim_relative:
    #             id: "light_1"
    #             relative_brightness: 5%
    #             transition_length: 0.1s
    #         - light.dim_relative:
    #             id: "light_2"
    #             relative_brightness: 5%
    #             transition_length: 0.1s
  - platform: template
    name: Deep Sleep Enabled
    id: deepSleepEnabled
    internal: True      

select:
  # - platform: ld2420
  #   operating_mode:
  #     name: Operating Mode

# number:
#   - platform: ld2420
#     presence_timeout:
#       name: Detection Presence Timeout
#     min_gate_distance:
#       name: Detection Gate Minimum
#     max_gate_distance:
#       name: Detection Gate Maximum
#     # See "Number" section below for detail
#     gate_select:
#       name: Select Gate to Set
#     still_threshold:
#       name: Set Still Threshold Value
#     move_threshold:
#       name: Set Move Threshold Value

# button:
#   - platform: ld2420
#     apply_config:
#       name: Apply Config
#     factory_reset:
#       name: Factory Reset
#     restart_module:
#       name: Restart Module
#     revert_config:
#       name: Undo Edits

deep_sleep:
  # ...
  id: "deep_sleep_manual"
  run_duration: 60s
  sleep_duration: 60s

  # wakeup_pin: GPIO4
  # touch_wakeup: true
  esp32_ext1_wakeup:
    pins:
      - GPIO3
    mode: ANY_HIGH

Anything in the logs that might be useful for us?

INFO ESPHome 2024.4.0
INFO Reading configuration /config/alpha.yaml...
WARNING The selected Arduino framework version is not the recommended one. If there are connectivity or build issues please remove the manual version.
WARNING The selected Arduino framework version is not the recommended one. If there are connectivity or build issues please remove the manual version.
WARNING GPIO8 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Generating C++ source...
INFO Compiling app...
Processing alpha-c3 (board: esp32-c3-devkitm-1; framework: arduino; platform: platformio/espressif32@5.4.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
Dependency Graph
|-- AsyncTCP-esphome @ 2.1.3
|-- WiFi @ 2.0.0
|-- FS @ 2.0.0
|-- Update @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.1.0
|-- DNSServer @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- noise-c @ 0.1.4
|-- Wire @ 2.0.0
|-- ArduinoJson @ 6.18.5
Compiling .pioenvs/alpha-c3/src/main.cpp.o
Archiving .pioenvs/alpha-c3/lib991/libAsyncTCP-esphome.a
Compiling .pioenvs/alpha-c3/lib18f/WiFi/WiFi.cpp.o
Compiling .pioenvs/alpha-c3/lib18f/WiFi/WiFiAP.cpp.o
src/main.cpp: In function 'void setup()':
src/main.cpp:770:22: error: 'class esphome::deep_sleep::DeepSleepComponent' has no member named 'set_ext1_wakeup'; did you mean 'ext1_wakeup_'?
   deep_sleep_manual->set_ext1_wakeup(deep_sleep::Ext1Wakeup{
                      ^~~~~~~~~~~~~~~
                      ext1_wakeup_
Compiling .pioenvs/alpha-c3/lib18f/WiFi/WiFiClient.cpp.o
*** [.pioenvs/alpha-c3/src/main.cpp.o] Error 1
========================== [FAILED] Took 3.39 seconds ==========================

Additional information

No response

ssieb commented 4 months ago

The C3 does not have ext1 wakeup. That really should be a validation error.