在垃圾佬那里淘了几只ESP32 的传感器,3.8一只,还不错
esphome:
name: esp32-pir
friendly_name: ESP32-PIR
name_add_mac_suffix: true
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# 设置API
api:
reboot_timeout: 0s
# encryption:
# key: !secret api_key
# 设置OTA
ota:
# password: !secret ota_password
#设置WIFI
wifi:
# ssid: !secret wifi_ssid
# password: !secret wifi_password
ssid: wifi
password: 12345678
fast_connect: True #不扫描直接连接,隐藏SSID必须启用
use_address: 10.1.0.14 #手动配置用于OTA的IP地址,默认用域名连接;
# 设置AP名称与密码
ap:
ssid: "ESP32-PIR"
password: !secret ap_password
# 如果wifi连接失败,启动热点
captive_portal:
#设置web服务器
#web_server:
# port: 80
##
#time:
# - platform: homeassistant
# id: ha_time
# timezone: "Asia/Shanghai"
button:
- platform: restart
name: "Restart"
id: reset1
binary_sensor:
- platform: gpio
pin: GPIO27
name: "Motion"
device_class: motion
id: motion
on_press:
then:
- light.turn_on: stateled
on_release:
then:
- light.turn_off: stateled
- platform: gpio
name: "Button"
pin:
number: GPIO2
mode: INPUT_PULLUP
inverted: true
# internal: True
on_multi_click:
- timing: ##连击3次;
- ON for at most 200ms
- OFF for at most 400ms
- ON for at most 200ms
- OFF for at most 400ms
- ON for at most 200ms
- OFF for at least 600ms
then:
- button.press: reset1
light:
- platform: status_led
name: "Status"
id: stateled
internal: True # 不在前端显示
pin:
number: GPIO19 #蓝色指示灯
inverted: False
|