Skip to content

Instantly share code, notes, and snippets.

@artipixel
Created April 9, 2021 10:44
Show Gist options
  • Save artipixel/b066d12d68d86f9be4b7ee7f6ddcaec8 to your computer and use it in GitHub Desktop.
Save artipixel/b066d12d68d86f9be4b7ee7f6ddcaec8 to your computer and use it in GitHub Desktop.
ESPHOME leak probe sensor
esphome:
name: flod_sensor_1
platform: ESP8266
board: d1_mini
wifi:
ssid: "YOUR-SSID"
password: "YOUR-PASS"
# manual_ip:
# static_ip: 192.168.1.88
# gateway: 192.168.1.1
# subnet: 255.255.255.0
logger:
# level: WARN
api:
ota:
sensor:
- platform: wifi_signal
name: "Kitchen Leak WiFi Signal"
update_interval: 15s
filters:
- sliding_window_moving_average:
window_size: 15
send_every: 15
send_first_at: 15
icon: mdi:wifi
- platform: adc
pin: A0
icon: mdi:water-alert
name: "Sink Leak"
id: sink_leak
update_interval: 3s
filters:
- multiply: 3.3
internal: true
binary_sensor:
- platform: template
name: "Kitchen Leak Status"
lambda: |-
float analog = id(sink_leak).state;
return analog < 2.55;
on_press:
then:
- switch.turn_on: flod1_status_led_blink
on_release:
then:
- switch.turn_off: flod1_status_led_blink
switch:
- platform: gpio
name: Flod sensor 1 status led
id: flod1_status_led
pin:
number: D4
inverted: true
- platform: template
name: flod1_status_led_blink
id: flod1_status_led_blink
optimistic: true
turn_on_action:
- while:
condition:
lambda: 'return true;'
then:
- switch.turn_on: flod1_status_led
- delay: 500ms
- switch.turn_off: flod1_status_led
- delay: 500ms
turn_off_action:
- switch.turn_off: flod1_status_led
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment