Salt Level For Water Softener With ESPHome


We got a water softener installed near the water mains coming into the house. It’s a “dumb” softener so that it does not rely on using electricity. This means it will continue to work in a power outage but the downside is it has no smarts about it. The unit uses salt blocks and needs to replaced on a regular basis.

How To Measure

Making the salt level available in Home Assistant will allow automations to trigger when the salt runs low. I’ve seen two ways to do this:

  1. Weight
  2. Distance
  3. Weight can use a load cell to measure the weight of the softener unit. The less salt that is left, the lighter the unit will weigh.

    With salt blocks (more like bars), the top of the top surface can be measured. The lower the salt is, the further away the distance will be from a fixed point in the water softener.

    Due to space constraints, I opted for the distance using an ultrasonic sensor. The water softener we got was the Kinetico Premier Compact


    HC-SR04 Ultrasonic Sensor

    I used an ESP32 and a HC-SR04.

    The wiring was slightly different compared to the below because my board had the VIN instead of 5V and it was on the opposite side to the 3v3 pin:
    ESP32 Pinout

    The wiring looks something like this:

    You can use a combined 4 jumper leads and connect it between your ultrasonic sensor and ESP32.

    The water softener lid where you remove to put new salt blocks in is an upside-down “L” shape held on with a magnet. This makes Jerry rigging something very easy: The top of the lid directly goes over the the salt blocks and the magnetic attachment allows the cables to be routed without any permanent mods.


    Configuring ESPHome is fairly easy. Make a note of the GPIO pin number for the trigger and echo wires. You’ll need to set those:
    - platform: ultrasonic
    trigger_pin: GPIO13
    echo_pin: GPIO12
    name: "Salt Level"

    Full example can be found here.

    Home Assistant

    I created a number help to set the low salt threshold. We have not used enough salt since we got the softener to truely know what is the the right value. Don’t forget to replace my notification script call with your own.

    The YAML automation can be found here.


    This will hopefully help make it easier and not forget to replace the salt. Next step is to tidy up the devices once I know it’s working. I suspect I could box the ESP32 and also fit it under the water softener case so that only the USB power cable is visible.

    Ultrasonic Distance Sensor

    About Danny

    I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Home Automation, IOT and tagged , , , , , . Bookmark the permalink.

    Leave a Reply

    Your email address will not be published. Required fields are marked *.

    All comments must go through an approval and anti-spam process before appearing on the website. Please be patience and do not re-submit your comment if it does not appear.

    This site uses Akismet to reduce spam. Learn how your comment data is processed.