Hi
I would trigger the buzzer connected at GPIO17 when i detect water in my basement. Now i´m sending the sate to HA and trig the buzzer by automation , but it would be better for me to have this internal in the ESP device, then the alarm will go off even if the HA server is down of some reason.
If possible i would like the buzzer not just turn on , but shifting from on to off in a cycle to give a pulsing sound,
- platform: adc
pin: GPIO32
name: "hp_room_water_level"
id: "hp_room_water_level"
attenuation: 11db #adjust the input voltage range from 1 volt to 3 volt
update_interval: 10s
# Example configuration entry
binary_sensor:
- platform: template
name: "basement_flooded"
lambda: |-
if (id(hp_room_water_level).state > 2.00) {
// basement is ok.
return false;
#set GPIO17 low
} else {
// basement is flooded.
return true;
#set GPIO17 high
}
switch:
- platform: gpio
pin: GPIO17
name: "buzzer_one"
id: "buzzer_one"