Tom DeCricle
Published © GPL3+

Home Assistant ESP32 Water-Softener Salt Tank Monitor IoT

Monitor the salt level in a water softener tank and send notifications to your email from home assistant

IntermediateFull instructions provided4 hours1,402
Home Assistant ESP32 Water-Softener Salt Tank Monitor IoT

Things used in this project

Hardware components

Seeed Studio esp32-c3
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1

Software apps and online services

Home Assistant
Home Assistant

Hand tools and fabrication machines

Drill / Driver, Cordless
Drill / Driver, Cordless

Story

Read more

Schematics

UltraBdv1 ESP32 HC-SR04 Schematic

Schematic Diagram

Code

ESP32_Salt.yaml

YAML
Use this code in ESPHome on Home Assistant
esphome:
    name: esp32salt
    friendly_name: ESP32Salt

esp32:
    board: esp32-c3-devkitm-1
    framework:
type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
    encryption:
        key: "<YOUR KEY>"

ota:
    password: "<YOUR OTA PASSWORD>"

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

manual_ip:
    static_ip: <ESP32 WIFI ADDRESS_IP>
    gateway: <NETWORK_GATEWAY_IP>
    subnet: <NETWORK_SUBNET_MASK_IP>
    dns1: <DNS_SERVER_IP>

# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
    ssid: "Esp32Salt Fallback Hotspot"
    password: "<SET_AD-HOC_WIFI_PASSWORD>"

captive_portal:

# Example configuration entry
sensor:
    - platform: ultrasonic
    trigger_pin: GPIO6
    echo_pin: GPIO7
    name: "Salt"
    update_interval: 1s
    unit_of_measurement: cm
    pulse_time: 20us
    accuracy_decimals: 4
    filters:
        - multiply: 100
        - exponential_moving_average:
            alpha: 0.001
            send_every: 1
        - clamp:
            min_value: 20
            max_value: 100
    on_value_range:
        above: 200
        then:
            - homeassistant.service:
                service: notify.gmail_notifier
                data:
                    target:
                        -"<target_eMAIL_ADDRESS1>"
                        -"<target_eMAIL_ADDRESS2>"
                    title: "Add Salt"
                    message: "Add Salt to the Water Softener Tank"
switch:
- platform: restart
name: esp32-Salt Restart

Credits

Tom DeCricle
6 projects • 2 followers
Electrical Engineer with experience in Schematic Design, PCB Layout, PCB Fabrication & Assembly Procurement, Hardware/Firmware/Software Dev
Contact

Comments

Please log in or sign up to comment.