HC-SR04 stopped working after 2022.12.x ESPHome

I have an esp32 with an HC-SR04 to measure distance. I got a notification to update it to the latest esphome (2022.12.x) and once I did, the sensor stopped updating. It shows the distance as 0.01m no matter how close/far something is to it. All the other sensors still update fine, wifi, uptime, etc. If I unplug the SR04 the distance goes to unavailable, so it seems to be reading the pins, but the values are not updating.

Here is my esp code.

esphome:
  name: garage-car-presence-sensor

esp32:
  board: esp32dev
  framework:
    type: esp-idf

# WiFi connection, correct these
# with values for your WiFi.
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_pwd
#  use_address: 10.0.86.82

# Enable Bluetooth Proxy
#bluetooth_proxy:
#  active: true

# Enable logging
logger:

# Enable Home Assistant API
api:

# Enable over-the-air updates.
ota:

# Enable Web server.
#web_server:
#  port: 80
  
# Sync time with Home Assistant.
time:
  - platform: homeassistant
    id: homeassistant_time

# Text sensors with general information.
text_sensor:
  # Expose ESPHome version as sensor.
  - platform: version
    name: Car_position_sensor ESPHome Version
  # Expose WiFi information as sensors.
  - platform: wifi_info
    ip_address:
      name: Car_position_sensor IP
    ssid:
      name: Car_position_sensor SSID
    bssid:
      name: Car_position_sensor BSSID

# Exposed switches.
# Switch to restart the Car_position_sensor.   
switch:
  - platform: restart
    name: "Car_position_sensor Restart"
# Sensors getting the distance between ceiling and car
# and converting them to the car height

sensor:
  # Uptime sensor.
  - platform: uptime
    name: Car_position_sensor Uptime

  # WiFi Signal sensor.
  - platform: wifi_signal
    name: Car_position_sensor WiFi Signal
    update_interval: 60s

  - platform: ultrasonic
    id: rawdist
    trigger_pin: GPIO5
    echo_pin: GPIO18
    name: "Left Garage Car Distance Raw"
    update_interval: 1s
    timeout: 4.0m

There don’t seem to be any changes to the code for over a year

Can you confirm a role back to the last working version (which one was this btw?) does recover the function of the ultrasonic?

Mine is working fine on a d1_mini. Maybe checking it every second burn it out? Try a smaller timeout, default is 2m. Maybe remove it just in case?

I’m running on a hiletgo esp32 and it was working on 2022.11, I updated to 2022.12 to get the new filesystem or whatever and it stopped working. I am not sure how to roll back, I tried rolling back my addon to 2022.10 but I wasn’t able to compile anything.

also changing the timeout and the interval didn’t change anything.

Ahh. When changing the filesystem/framework, they recommend updating via USB not wifi. Can also try reverting to the framework type: arduino and see if that helps. Clicking “Clean Build Files” can help when have compile errors (in the 3-dot menu)

If that does not work, post an issue if you are 100% sure your ultrasonic sensor is not fried.

I did all that, and tried 2 different esp32s and 2 different sensors. will open an issue