Invalid readings from HC-SR04

I’m trying to use an HC-SR04 as a presence sensor in my garage.

I’m having an issue with the readings it’s sending to HA. I’ve tried various boards and haven’t found differences in the way they report what seem to be invalid readings back to HA.

I’m following this as a general guide:

esphome:
  name: dev-device
  friendly_name: Dev Device

esp8266:
  board: nodemcuv2

# Enable logging
logger:

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

ota:
  password: ""

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Dev-Device Fallback Hotspot"
    password: "XXXXXX"

captive_portal:
    
sensor:
 - platform: ultrasonic
   trigger_pin: D6
   echo_pin: D5
   name: 'Dads Garage Space'
   update_interval: 10s
   accuracy_decimals: 2
   unit_of_measurement: cm

I’m seeing 0.00 on my dashboard card but if I look at the logs this is what I see.

[18:01:00][D][sensor:093]: ‘Dads Garage Space’: Sending state 0.00103 cm with 2 decimals of accuracy
[18:01:10][D][ultrasonic.sensor:040]: ‘Dads Garage Space’ - Got distance: 0.007 m
[18:01:10][D][sensor:093]: ‘Dads Garage Space’: Sending state 0.00686 cm with 2 decimals of accuracy
[18:01:20][D][ultrasonic.sensor:040]: ‘Dads Garage Space’ - Got distance: 0.001 m
[18:01:20][D][sensor:093]: ‘Dads Garage Space’: Sending state 0.00120 cm with 2 decimals of accuracy
[18:01:30][D][ultrasonic.sensor:040]: ‘Dads Garage Space’ - Got distance: 0.003 m
[18:01:30][D][sensor:093]: ‘Dads Garage Space’: Sending state 0.00309 cm with 2 decimals of accuracy
[18:01:40][D][ultrasonic.sensor:040]: ‘Dads Garage Space’ - Got distance: 0.006 m
[18:01:40][D][sensor:093]: ‘Dads Garage Space’: Sending state 0.00600 cm with 2 decimals of accuracy
[18:01:50][D][ultrasonic.sensor:040]: ‘Dads Garage Space’ - Got distance: 0.002 m
[18:01:50][D][sensor:093]: ‘Dads Garage Space’: Sending state 0.00171 cm with 2 decimals of accuracy

During this time the sensor is not being moved or disturbed.

I obviously do not need perfect distance readings but I’ll need some sort of baseline reading when there is a vehicle present and absent.

I’ve searched several sites and many of them specify Audrino code so I don’t think that’s helpful Is there something I’m missing here?

Even the ESPHome documentation doesn’t seem to have much on these sensors.

Thanks in advance.