98 lines
2.2 KiB
YAML
98 lines
2.2 KiB
YAML
substitutions:
|
|
device_name: bedroom_tkm_lily1
|
|
device_ip: 192.168.87.44
|
|
|
|
esphome:
|
|
name: ${device_name}
|
|
platform: ESP32
|
|
board: esp32dev
|
|
on_boot:
|
|
- priority: 900 #900 tried down to 500
|
|
then:
|
|
- lambda: |-
|
|
id(wake_up_reason) = log(esp_sleep_get_ext1_wakeup_status())/log(2);
|
|
|
|
wifi:
|
|
ssid: !secret wifi_ssid
|
|
password: !secret wifi_password
|
|
manual_ip:
|
|
static_ip: ${device_ip}
|
|
gateway: 192.168.86.1
|
|
subnet: 255.255.254.0
|
|
fast_connect: True
|
|
|
|
# captive_portal:
|
|
|
|
# Enable logging
|
|
logger:
|
|
level: INFO
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
|
|
ota:
|
|
<<: !include standard_mqtt.yaml
|
|
# mqtt:
|
|
# broker: !secret mqtt_broker
|
|
# discovery: True
|
|
# username: !secret mqtt_username
|
|
# password: !secret mqtt_password
|
|
# # keepalive: 2s
|
|
# birth_message:
|
|
# topic: ${device_name}/status
|
|
# payload: coming_online_birth
|
|
# will_message:
|
|
# topic: ${device_name}/status
|
|
# payload: going_offline_will
|
|
# on_message:
|
|
# topic: ${device_name}/ota_mode
|
|
# payload: 'ON'
|
|
# then:
|
|
# - deep_sleep.prevent: deep_sleep_1
|
|
|
|
deep_sleep:
|
|
run_duration: 20s
|
|
sleep_duration: 40s #24h
|
|
esp32_ext1_wakeup:
|
|
pins:
|
|
- 33 #yellow
|
|
- 34 #orange
|
|
- 35 #green
|
|
mode: ANY_HIGH
|
|
id: deep_sleep_1
|
|
|
|
globals:
|
|
- id: wake_up_reason
|
|
type: int
|
|
restore_value: no
|
|
initial_value: '0'
|
|
sensor:
|
|
- platform: template
|
|
name: "Remote Control Wake Reason"
|
|
accuracy_decimals: 0
|
|
lambda: |-
|
|
return id(wake_up_reason);
|
|
|
|
binary_sensor:
|
|
- platform: gpio
|
|
pin:
|
|
number: GPIO33
|
|
mode: INPUT_PULLUP
|
|
# filters:
|
|
# - delayed_on: 10ms ### <---- debounce time, was 100ms
|
|
# - delayed_off: 10s ### <---- delay to capture state change on wake up
|
|
name: "TKM Test 33 (yellow)"
|
|
id: tkm_test_33
|
|
- platform: gpio
|
|
pin:
|
|
number: GPIO34
|
|
mode: INPUT_PULLUP
|
|
name: "TKM Test 34 (orange)"
|
|
id: tkm_test_34
|
|
- platform: gpio
|
|
pin:
|
|
number: GPIO35
|
|
mode: INPUT_PULLUP
|
|
name: "TKM Test 35 (green)"
|
|
id: tkm_test35
|