I have an HC-SR04 Ultrasound sensor that I use to check the water level in a tank.
Of course out of the box it displays the water level like 5cm when full and 65cm when almost empty.
I use a lovelace gauge card to display this.
I am struggling to find info on how to change my configuration file so it would display 100% when full ( equal to 5cm distance) and 10% when almost empty at 65cm .
I was hoping there was someone here that knows how to modify my yaml file below. Thanks in advance !!
esphome:
name: salt-water-level
friendly_name: Salt Water Level
platform: ultrasonic
trigger_pin: GPIO4 # Replace with your actual trigger pin (e.g., GPIO2)
echo_pin: GPIO2 # Replace with your actual echo pin (e.g., GPIO4)
name: “Salt Water Level”
unit_of_measurement: “cm” # Or your preferred unit
filters:
multiply: 100 # convert meters to cm
accuracy_decimals: 1
update_interval: 2s # Adjust as needed
platform: ultrasonic
trigger_pin: GPIO4 # Replace with your actual trigger pin (e.g., GPIO2)
echo_pin: GPIO2 # Replace with your actual echo pin (e.g., GPIO4)
name: “Salt Water Level”
unit_of_measurement: “%” # Or your preferred unit
filters:
multiply: 100 # convert meters to cm
accuracy_decimals: 1
update_interval: 2s # Adjust as needed
INFO ESPHome 2025.4.0
INFO Reading configuration /config/esphome/salt-water-level.yaml…
ERROR Error while reading config: Invalid YAML syntax:
while parsing a block mapping
in “/config/esphome/salt-water-level.yaml”, line 31, column 5
expected , but found ‘’
in “/config/esphome/salt-water-level.yaml”, line 40, column 7
Please share more info about the hardware part. I’m looking for a way to monitor the groundwater level underneath my home without opening the latch every time.