Trying to do when PIR sensor detect movement buzzer start.
I have already made a PIR sensor on one esp8266 and it works properly https://esphome.io/cookbook/pir.html
On second Wemos d1 mini using a 2 pin passive buzzer connected between D1 and GND. Code below Im new in this…
How to get entity so I can make automation rule (start buzzer on PIR movement)?
esphome:
name: node_buzzer_001
platform: ESP8266
board: d1_mini
wifi:
ssid: "****"
password: "****"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Node Buzzer 001 Fallback Hotspot"
password: "********"
captive_portal:
# Enable logging
logger:
ota:
output:
- platform: esp8266_pwm
pin: D1
id: buzzer
# Enable Home Assistant API
api:
services:
- service: pir_sensor
then:
- output.esp8266_pwm.set_frequency:
id: buzzer
frequency: 800Hz
- output.set_level:
id: buzzer
level: 50%
- delay: 120ms
- output.turn_off: buzzer
- delay: 200ms
- output.esp8266_pwm.set_frequency:
id: buzzer
frequency: 1000Hz
- output.set_level:
id: buzzer
level: 50%
- delay: 120ms
- output.turn_off: buzzer