Salt sentry: Water softener monitoring device

For the last few months I’ve been busy creating a device to monitor when it is time to refill the salt blocks in my water softerner (Aquacell). I was tired of regularly checking whether I had to put new blocks of salt in it, and often forgot to do it on time.

I used a VL53L0X time of flight sensor to measure the distance from the top of the water softener to the salt blocks and a ESP8266 that connects to my wifi to send the measured distance and percentage to home assistant via MQTT:

I have a few left over and might get a bigger batch created if there’s interest: Salt Sentry - Water softener monitor from Lemcke Solutions on Tindie

1 Like

That’s way cool! I’m using a door sensor now. Have to think this over a bit!

That is a little more custom than my setup.
I just have an ultrasonic sensor connected to a raspberry pi:
https://github.com/GlennGoddard/Salt-Level

1 Like

That will probably work just as wel and might be a bit cheaper (If you can get hold of a raspberry pi).

I’ve struggled with corrosion in my softener and TOF sensor. Have you had one of these in place for a while?

I’ve had it in place for about 4 months now, no signs of corrosion at all.

That’s awesome, I’ll have to dig into mine more then.

Looks like I missed the boat on this. Any plans to create more? I’m using a Pentair salt monitor but it keeps resetting and has no integration with Home assistant.

I have ordered a new batch of 50 pieces, but due to component shortages, it is taking quite a bit longer than expected. It’s probably going to take another month before I have them.

1 Like

They’re back in stock :slight_smile:

I was even able to shrink the height of it a bit by changing some components

1 Like

I just came across these. I was wondering if this could be used to measure a water tank level?

@ErikNL Do you have some home assistant screenshots and/or the yaml to make this work?

Unfortunately, the sensor doesn’t work that well on water, if you can however put something floating in the water, it would work.

I configured the topic hal/saltsentry in the saltsentry I use myself, and added these two configurations to configuration.yaml

  - platform: mqtt
    name: "Salt sentry percentage"
    state_topic: "hal/saltsentry"
    qos: 0
    unit_of_measurement: "%"
  - platform: mqtt
    name: "Salt sentry cm"
    state_topic: "hal/saltsentry_distance"
    qos: 0
    unit_of_measurement: "cm"

In the UI, it looks like this:

image

1 Like

@ErikNL Good deal, pretty straight to the point, thanks!

Mine arrived a few days ago. Set it up yesterday, it’s working like a charm! Nice work!

One small thing, at the bottom of page 7 of the English manual the second sensor setup should be state_topic: "hallway/saltsentry_distance"

Thanks for the comment, I’ve updated the manual.

I also recently (after a question from a user) tried to see if the module would wok with ESPHome, I got it working with the following code:

esphome:
  name: salt-sentry

esp8266:
  board: esp_wroom_02

i2c:
  sda: 2
  scl: 14
  scan: true
  id: bus_a
    
sensor:
  - platform: vl53l0x
    name: "VL53L0x Distance"
    address: 0x29
    update_interval: 60s
    long_range: false
    unit_of_measurement: cm

The Salt sentry will now send the measured distance in cm to Home assistant. To get a full/empty percentage, you can configure a template senor.

Did some more fiddling around and came up with a better ESPHome config that will also calculate the percentage:

esphome:
  name: salt-sentry

esp8266:
  board: esp_wroom_02

i2c:
  sda: 2
  scl: 14
  scan: true

globals:
   - id: full_cm
     type: float
     initial_value: '5'
   - id: empty_cm
     type: float
     initial_value: '35'

sensor:
  - platform: vl53l0x
    id: distance_m
    address: 0x29
    update_interval: 60s
    long_range: false
    internal: true
  - platform: template
    unit_of_measurement: cm
    icon: mdi:arrow-expand-down
    name: distance
    id: distance
    update_interval: 60s
    lambda: |- 
      return id(distance_m).state * 100;
  - platform: template
    name: "percentage"
    unit_of_measurement: '%'
    icon: mdi:percent
    lambda: |-
      if (id(distance).state < id(full_cm)) {
        return 100;
      }
      
      if (id(distance).state > id(empty_cm)) {
        return 0;
      }
      
      return 100 - (id(distance).state - id(full_cm))  / ((id(empty_cm) - id(full_cm)) / 100);
    update_interval: 60s

The values in the “globals” section should be changed to reflect the number of cm when the water softener should be seen as full or empty.

2 Likes

Just ordered mine, bit of a price increase since i last checked, but that’s fine. Looking forward to this.

My Salt Sentry just arrived. Immediately I added it to ESPHome with your above code. I did a few things like:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "0142casdfasdcca51"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  # Add a default domain name  
  domain: .temp.nl

# Enable Web server.
web_server:
  port: 80

# Sync time with Home Assistant.
time:
  - platform: homeassistant
    id: homeassistant_time

But for some reason the sensors present ‘unknown’.

If I check the logs I’m seeing the following:

[D][api.connection:917]: Home Assistant 2022.10.5 (192.168.21.92): Connected successfully
[D][time:041]: Synchronized time: 2022-10-26 16:28:14
[D][sensor:126]: 'distance': Sending state nan cm with 1 decimals of accuracy
[D][sensor:126]: 'percentage': Sending state -nan % with 1 decimals of accuracy
[D][sensor:126]: 'distance': Sending state nan cm with 1 decimals of accuracy

Any thoughts?