From 18adfddb2771619b21fba66576854bbf70f8c4f6 Mon Sep 17 00:00:00 2001 From: Tim Meneely Date: Sat, 23 Jan 2021 22:41:54 -0500 Subject: [PATCH] Starting on new ESP32 mini --- bedroom_tkm1.yaml | 111 ++++++++++++++++++++++++++++++++++++ bedroom_tkm1/partitions.csv | 6 ++ upload_bedroom_tkm1 | 1 + write_bedroom_tkm1 | 1 + 4 files changed, 119 insertions(+) create mode 100644 bedroom_tkm1.yaml create mode 100644 bedroom_tkm1/partitions.csv create mode 100644 upload_bedroom_tkm1 create mode 100644 write_bedroom_tkm1 diff --git a/bedroom_tkm1.yaml b/bedroom_tkm1.yaml new file mode 100644 index 0000000..37738d9 --- /dev/null +++ b/bedroom_tkm1.yaml @@ -0,0 +1,111 @@ +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 diff --git a/bedroom_tkm1/partitions.csv b/bedroom_tkm1/partitions.csv new file mode 100644 index 0000000..f846601 --- /dev/null +++ b/bedroom_tkm1/partitions.csv @@ -0,0 +1,6 @@ +nvs, data, nvs, 0x009000, 0x005000, +otadata, data, ota, 0x00e000, 0x002000, +app0, app, ota_0, 0x010000, 0x1C0000, +app1, app, ota_1, 0x1D0000, 0x1C0000, +eeprom, data, 0x99, 0x390000, 0x001000, +spiffs, data, spiffs, 0x391000, 0x00F000 diff --git a/upload_bedroom_tkm1 b/upload_bedroom_tkm1 new file mode 100644 index 0000000..c24b217 --- /dev/null +++ b/upload_bedroom_tkm1 @@ -0,0 +1 @@ +esphome bedroom_tkm1.yaml run --upload-port 192.168.87.36 diff --git a/write_bedroom_tkm1 b/write_bedroom_tkm1 new file mode 100644 index 0000000..148bf3c --- /dev/null +++ b/write_bedroom_tkm1 @@ -0,0 +1 @@ +esphome bedroom_tkm1.yaml run --upload-port /dev/ttyS4