Skip to content

Instantly share code, notes, and snippets.

@MoritzBuetzer
Created October 17, 2019 09:38
Show Gist options
  • Save MoritzBuetzer/4871bafb3e67397615d26435bc95bb57 to your computer and use it in GitHub Desktop.
Save MoritzBuetzer/4871bafb3e67397615d26435bc95bb57 to your computer and use it in GitHub Desktop.
Ultrasonic Saltlevel sensor
# Ultrasonic Saltlevel sensor
# Source: https://adonno.com/salt-level-sensor/
esphome:
name: salt_level_sensor
platform: ESP8266
board: d1_mini
# WiFi connection, replace these with values for your WiFi.
wifi:
ssid: DEINE_WLAN_SSID
password: DEIN_WLAN_PASSWORT
# Enable logging
logger:
# Enable Home Assistant API
api:
# Enable over-the-air updates.
ota:
# Enable Web server.
web_server:
port: 80
# Sync time with Home Assistant.
time:
- platform: homeassistant
id: homeassistant_time
# Text sensors with general information.
text_sensor:
# Expose ESPHome version as sensor.
- platform: version
name: salt_level_sensor ESPHome Version
# Expose WiFi information as sensors.
- platform: wifi_info
ip_address:
name: salt_level_sensor IP
ssid:
name: salt_level_sensor SSID
bssid:
name: salt_level_sensor BSSID
# Exposed switches.
# Switch to restart the salt_level_sensor.
switch:
- platform: restart
name: "salt_level_sensor Restart"
sensor:
# Uptime sensor.
- platform: uptime
name: salt_level_sensor Uptime
accuracy_decimals: 0
# WiFi Signal sensor.
- platform: wifi_signal
name: salt_level_sensor WiFi Signal
update_interval: 60s
accuracy_decimals: 1
- platform: ultrasonic
trigger_pin: D1
echo_pin: D2
name: "Saltlevel in cm"
update_interval: 60s
unit_of_measurement: "cm"
accuracy_decimals: 0
filters:
- multiply: 100
- platform: ultrasonic
trigger_pin: D1
echo_pin: D2
name: "Saltlevel in %"
update_interval: 60s
unit_of_measurement: "%"
accuracy_decimals: 1
filters:
- lambda: return ((x-0.24)*100)/(0.88-0.24);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment