本帖最后由 qjiang 于 2019-5-21 23:10 编辑
这个是esp32芯片用的 不是8266的
esphome配置文件:
deep_sleep:
run_duration: 20s
sleep_duration: 30min
id: deep_sleep_1
wakeup_pin_mode: KEEP_AWAKE
wakeup_pin: 14
binary_sensor:
- platform: gpio
pin:
number: GPIO14
mode: INPUT_PULLUP
name: "自动人体传感器"
device_class: motion
on_release:
then:
- deep_sleep.enter: deep_sleep_1
on_press:
then:
- deep_sleep.prevent: deep_sleep_1
每30分钟唤醒我是为了让温度传感器上报温度。理论上触发不多的话一节锂电池用个3-5年没什么问题
自己测试了几台,今天又改了下代码 暂时没什么问题, 还希望大佬指点改进!
esphome:
name: sr501
platform: ESP32
board: nodemcu-32s
on_boot:
priority: 50
then:
- lambda: |-
id(sr501).publish_state(false);
wifi:
ssid: "youssid"
password: "12345678"
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
deep_sleep:
id: deep_sleep_1
wakeup_pin_mode: KEEP_AWAKE
wakeup_pin: 14
binary_sensor:
- platform: gpio
pin:
number: GPIO14
mode: INPUT_PULLUP
name: "SR501人体传感器"
id: sr501
device_class: motion
on_release:
then:
- lambda: |-
id(sr501).publish_state(false);
- deep_sleep.enter: deep_sleep_1
on_press:
then:
- deep_sleep.prevent: deep_sleep_1
|