Salt sentry: Water softener monitoring device

Thanks for the follow up, looks like I missed out on grabbing one while they were in stock - looking forward to September!

the small stock I had wend really fast, sorry. will report back when I have new stock

@ErikNL do you have any update on new batch? I have just come across this and am pretty interested.

My water softener (similar to Harvey’s dumb softners) doesn’t have any power to it and I don’t have power close. However, do you think a battery pack would work? The type that you can charge iPhones/iPads etc from? I have a 22,000mAh battery knocking around. Do you think this would last long between charges? Does the device use much electric?

It took some time to get the right spare parts for the 3D printer, but I now have them and will probably have a new batch ready next week.

Although I didn’t really design the Salt sentry to run of a battery pack, it should technically not be a problem to run it off a battery pack. I believe it consumes around 70.5 mA, so it should last about a month on a battery pack.

It could however be much longer it the microcontroller (esp8266) is set to go in deep sleep and only wakeup every now and then to report the measured distance. If you’re using ESPhome, I believe it can be dome with this code:

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: 10min
    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: 10min

deep_sleep:
  run_duration: 10sec
  sleep_duration: 10min

I have not yet tested if tis really works, but it should improve battery life quite significantly

1 Like

Thank you. I look forward to ordering one when they are ready

The 3D printer is fixed and they’re back in stock now: https://www.tindie.com/products/ErikLemcke/salt-sentry-water-softener-monitor/

1 Like

Thanks. The Salt Sentry came today :slightly_smiling_face:
I have it setup on WiFi and MQTT and battery bank but am just going to start exploring ESPHome to explore your code above. Just an FYI, I notice the ESP Home section in the NL pdf manual is English instructions and the English manual is the Dutch instructions

@ErikNL would you mind helping please?

So on wifi, the SaltSentry appears to do the first update to MQTT but no more subsequent updates.
So I thought I would go the ESPHome route. I havent really played with ESPHome but thought I would give it a try (I have 3 Everything Presence 1 sensors working in ESP Home so that is up and running ok).

I clicked on Add Device, select Continue and choose ESP8266. If I then choose plugged into computer I dont get the USB connected option (I do get it when trying to add an EP1). So I went back and chose Wireless connection option (I have set the IP to 192.168.1.119 and I can browse the SS website). Installer runs through and then says it cant find the device on the network. I then add some code (as referenced in the error) to set ESPHome to use static IP however when I try to then run the install again, using defaults or even using a mix of your settings above and defaults, I get the following connection refused:

Archiving /data/saltsentry/.pioenvs/saltsentry/libFrameworkArduino.a
Linking /data/saltsentry/.pioenvs/saltsentry/firmware.elf
RAM: [==== ] 42.3% (used 34628 bytes from 81920 bytes)
Flash: [===== ] 48.0% (used 501437 bytes from 1044464 bytes)
Building /data/saltsentry/.pioenvs/saltsentry/firmware.bin
esp8266_copy_factory_bin(["/data/saltsentry/.pioenvs/saltsentry/firmware.bin"], ["/data/saltsentry/.pioenvs/saltsentry/firmware.elf"])
========================= [SUCCESS] Took 59.75 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.1.119
ERROR Connecting to 192.168.1.119:8266 failed: [Errno 111] Connection refused

The default code, with adding static IP, is:

esphome:
  name: saltsentry
  friendly_name: SaltSentry

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "pVwmO9SlYZ9aN6lj4/tf2mPoJHiy1IPDI35eyVqXjbg="

ota:
  password: "c1cdaca40068f51b4a785de169a9294d"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.1.119
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Saltsentry Fallback Hotspot"
    password: "GWA98ZMhjXNB"

captive_portal:

And I have also tried changing that to:

esphome:
  name: saltsentry
  friendly_name: SaltSentry

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: 10min
    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: 10min

deep_sleep:
  run_duration: 10sec
  sleep_duration: 10min

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "pVwmO9SlYZ9aN6lj4/tf2mPoJHiy1IPDI35eyVqXjbg="

ota:
  password: "c1cdaca40068f51b4a785de169a9294d"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.1.119
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Saltsentry Fallback Hotspot"
    password: "GWA98ZMhjXNB"

captive_portal:
    

But still get connection refused.

Also, just an FYI, when connected to MQTT and the battery pack, the initial message is being sent to MQTT however any subsequent messages are not going and the device appears to drop wifi :frowning:

Any ideas?

To use the Salt sentry with ESPhome, you will need to connect it to USB when flashing it for the first time. It might be that you need to install a driver for the usb to serial chip the Salt sentry uses (CH340), I believe I used this driver, but there are a few different download links here: How to Install CH340 Drivers - SparkFun Learn

Are you sure that only the initial message is being send? when the measured distance does not change, home assistant will just ignore the new measurement.

@ErikNL thank you. I will look into the driver issue. I think I have added complexity as I am doing this on a Mac, so will need to boot into Windows and try again.

Yep, 100% sure no messages are being sent after the initial entry - I am running MQTT Explorer and left that running for an hour connected to MQTT - the history shows no further updates. Maybe because SaltSentry is entering low power state after the initial bootup/message send it is not enough power draw for the battery to detect and therefore kills the USB port of power?

@ErikNL I think I have got round the no messages being sent issue. So the battery that I have has a button that you can press to see the charge level (a series of 5 LED’s light up to show state of charge). When I press the button, the USB ports get powered up and SaltSentry sends an updated message.

So to take this a step further, I have bought my first SwitchBot. I have attached it to the battery and setup an automation - for testing, I set it to press the button once every 10 minutes and I have been getting constant MQTT messages through every 10 minutes. I have now changed that down to once an hour :slight_smile: battery should last longer and I dont think I need readings more often than an hour?

There are also instructions for installing the driver on MacOs, so technically, you should also be able to do it on a mac directly.

Cool solution for the problem :slight_smile: Once every hour should normally be enough. In my water softener (aquacell) I need to fill the salt every three weeks, so even if I would get a measurement once a day, I would basically still be ok. This is my percentage graph for the last 6 months:

@ErikNL thanks for the tips. Unfortunatly I tried the Mac drivers already and got nowhere. No big problem though, I will just load Bootcamp and try from there.

Regarding the measurement of the cavity, is the max distance to the top of the water, or can the sensor read the block when it is lower than the top of the water? My unit is a rebadged Harveys water softner and the water line is a few cm above the platform where the salt block sits

Firstly,my apologies for my late response, I missed your message.

To address your question: The Salt Sentry is designed to measure distances in open air and isn’t calibrated to read through water. So, if the salt block goes below the water line, the device will most likely register the distance to the top of the water rather than the top of the salt block.

1 Like

This looks really cool especially with the 3d printed case. I am very new to home assistant, slowly moving from smartthings and webcore (dead I know). Tried sharptools but a friend really pushed HA on me and I’m liking it. I sent you a message on the store and I’ll ask here as well:

  1. for a new to HA how hard is it to link? I see you helped a lot of people out but the code you posted, but I wouldn’t even know where to put that in HA… I can follow directions in tech ok. I would like something like this and if its simple add on I’m in.
  1. I saw that this device uses a laser to measure distance? I use salt pellets for my softner, they are more like crystals than round (blue bags in US) would it be a problem reflecting the laser back? I have seen some ultrasound options so I am wondering how would the 2 compare?

Linking the device to HA isn’t that difficult. For a detailed step-by-step guide, you can find our manual here: Salt Sentry Manual. (make sure to click on the “more pages” link in the bottom) This manual provides all the information you need, and if there are any areas where you’re unsure or need clarification, please don’t hesitate to ask.

One important thing to note: For the Salt Sentry to communicate with HA, you will need to set up MQTT in Home Assistant. If you haven’t already set up MQTT, a popular and straightforward option is to use the Mosquitto broker as an add-on within HA.

Regarding your question about the laser: Yes, the Salt Sentry does use a time-of-flight sensor (a type of laser) to measure the distance. I’vehad several users who use salt pellets similar to the ones you mentioned, and they’ve reported no issues regarding the reflection of the laser.

As for ultrasound options: While ultrasound might work for some applications, it can potentially be less accurate compared to a time-of-flight sensor. I’m not entirely certain about the exact differences in accuracy between the two, but from my experience, the laser sensor in the Salt Sentry has consistently provided precise readings.

Thank you! ordered and anxiously await to use it

@ErikNL Just discovered this. Ordered mine, have 4 other guys interested but one 1 left in stock! What’s been the average turn around for re-stocking?

Thanks for your order! I’ve just shipped the package.
I do still have a lot of pcb’s for the device, but I’m currently out of 3D printed housings. The 3D printer is currently residing at a compagnons place, so I will urge him to print a batch of housings now that I know more people are waiting for them, thanks for letting me know :slight_smile:

I will give you a message as soon as I have them in stock again.

A completely different topic - I dont suppose this could measure how much fuel oil (mazout / diesel) is in a tank? I’ve about to order one for my salt, but would be amazing if it could measure distance in a fuel tank too…