esphome: name: bedroom_tkm1 platform: ESP32 board: esp-wrover-kit on_boot: priority: 900 then: - lambda: |- id(wake_up_reason) = log(esp_sleep_get_ext1_wakeup_status())/log(2); wifi: ssid: "Meneely" password: "punxsutawney1" # Enable fallback hotspot (captive portal) in case wifi connection fails # ap: # ssid: "BigBlue1 Fallback Hotspot" # password: "QNWj7LmaNoD6" manual_ip: # Set this to the IP of the ESP static_ip: 192.168.87.36 # Set this to the IP address of the router. Often ends with .1 gateway: 192.168.86.1 # The subnet of the network. 255.255.255.0 works for most home networks. subnet: 255.255.254.0 fast_connect: True # captive_portal: # Enable logging logger: level: INFO # Enable Home Assistant API api: ota: mqtt: broker: 192.168.86.99 discovery: True username: ha password: lorrie keepalive: 2s birth_message: topic: bedroom_tkm1/status payload: coming_online_birth will_message: topic: bedroom_tkm1/status payload: going_offline_will on_message: topic: bedroom_tkm1/ota_mode payload: 'ON' then: - deep_sleep.prevent: deep_sleep_1 deep_sleep: run_duration: 20s sleep_duration: 1min #24h esp32_ext1_wakeup: pins: #[12] #, 14, 27] - GPIO12 - GPIO14 - GPIO27 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); on_value: then: - if: condition: lambda: 'return id(wake_up_reason) == 12;' then: - logger.log: "12, Green wire touched" else: - logger.log: "Non-green wire touched" binary_sensor: - platform: gpio pin: number: GPIO12 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 12 (Green)" id: tkm_test_12 - platform: gpio pin: number: GPIO14 mode: INPUT_PULLUP name: "TKM Test 14 (Yellow)" id: tkm_test_14 - platform: gpio pin: number: GPIO27 mode: INPUT_PULLUP name: "TKM Test 27 (Orange)" id: tkm_test27