I have searched but was unsuccessful in finding a solution. I have an ESP8266 with ESPHOME installed on it. There are 3 sensors and 1 buzzer connected to the ESP8266. I want to create an automation that will trigger the buzzer when certain parameters go out of range. For example, if the water temperature exceeds 75 degrees, I want the buzzer to sound. Is this achievable with ESPHOME and HA Automation? Here is my current YAML source code; any guidance would be much appreciated.
substitutions:
name: "saltwater"
friendly_name: Salt Water Fish Tank
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
project:
name: esphome.web
version: '1.0'
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
# Allow provisioning Wi-Fi via serial
improv_serial:
wifi:
# Set up a wifi access point
ap: {}
# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:
dashboard_import:
package_import_url: github://esphome/example-configs/esphome-web/esp8266.yaml@main
import_full_config: true
# To have a "next url" for improv serial
web_server:
# Define buzzer component (replace GPIOx with a supported pin)
output:
- platform: gpio
pin: GPIO15 # Replace GPIO15 with a valid GPIO pin number
id: buzzer_output
# Define binary sensor for water float sensor
binary_sensor:
- platform: gpio
pin: GPIO2
name: "SaltWater - Water Level Sensor"
filters:
- delayed_on: 500ms
- delayed_off: 500ms
# Define sensors
dallas:
- pin: GPIO4
# Define sensors
sensor:
- platform: dallas
address: 0x0e0302979409c628
name: "Salt Water Temperature"
unit_of_measurement: "°F"
filters:
- lambda: return x * (9.0/5.0) + 32.0;
- platform: adc
pin: GPIO17
name: "SaltWater - TDS Sensor"
update_interval: 60s
filters:
- calibrate_linear:
- 0.0 -> 0.0
- 4095.0 -> 2000.0 # Adjust this calibration value according to your TDS sensor
unit_of_measurement: "ppm"
It all comes down to whether its a passive buzzer or not. If you dont know because you didnt build the circuit yourself then if you could identify the board name or even a picture.
I struggled for 10 minutes getting the format/spacing correct on what you gave me. I finally got it and it works like a charm. So this is done via the yaml file and not in the automation area correct? I need to add other alerts like if water is below 65F , then buzzer. If I want to setup email alerts, that would be done in the automation area and or in the yaml file right?
Below is what I put in and it worked perfectly. Your assistance is very much appreciated.
I do have one more thing I need help adding. I have a water float sensor. It is a 2 wire. It’s either on or off. How can I add the same feature to sound buzzer if the state is changed to off?
# Define binary sensor for water float sensor
binary_sensor:
- platform: gpio
pin: GPIO2
name: "SaltWater - Water Level Sensor"
filters:
- delayed_on: 500ms
- delayed_off: 500ms
Esphome is actually working fabulously standalone. Web Server and Automations, HTTP api and MQTT is all what I really need. I don’t need fancy dashboard on my wall.
Only thing I have ever missed is numeric input on the web server.
Few Esphomes are taking care of my PV system, power diverter for hot water, ble thermo-hygrometers, heat pumps, some switches and outlets…