Starting on new ESP32 mini

This commit is contained in:
Tim Meneely
2021-01-23 22:41:54 -05:00
parent 806480d924
commit 18adfddb27
4 changed files with 119 additions and 0 deletions

111
bedroom_tkm1.yaml Normal file
View File

@@ -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

View File

@@ -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
1 nvs, data, nvs, 0x009000, 0x005000,
2 otadata, data, ota, 0x00e000, 0x002000,
3 app0, app, ota_0, 0x010000, 0x1C0000,
4 app1, app, ota_1, 0x1D0000, 0x1C0000,
5 eeprom, data, 0x99, 0x390000, 0x001000,
6 spiffs, data, spiffs, 0x391000, 0x00F000

1
upload_bedroom_tkm1 Normal file
View File

@@ -0,0 +1 @@
esphome bedroom_tkm1.yaml run --upload-port 192.168.87.36

1
write_bedroom_tkm1 Normal file
View File

@@ -0,0 +1 @@
esphome bedroom_tkm1.yaml run --upload-port /dev/ttyS4