Flashing Sonoff Minis

This commit is contained in:
2021-01-30 14:21:31 -05:00
parent cf8a6b9ca7
commit 7dd07e3c54
3 changed files with 312 additions and 0 deletions

124
bedroom_tkm1cam.yaml Normal file
View File

@@ -0,0 +1,124 @@
esphome:
name: bedroom_tkm1
platform: ESP32
board: esp32cam
on_boot:
- priority: -100 #900 tried down to 500
then:
- lambda: |-
id(wake_up_reason1) = esp_sleep_get_ext1_wakeup_status();
- priority: 900 #900 tried down to 500
then:
- lambda: |-
id(wake_up_reason) = esp_sleep_get_ext1_wakeup_status();
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_tkm1cam/status
payload: coming_online_birth
will_message:
topic: bedroom_tkm1cam/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: 40s #24h
esp32_ext1_wakeup:
pins:
- 13 #yellow
- 12 #orange
- 15 #green
mode: ANY_HIGH
id: deep_sleep_1
globals:
- id: wake_up_reason
type: int
restore_value: no
initial_value: '0'
- id: wake_up_reason1
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);
- platform: template
name: "Remote Control Wake Reason1"
accuracy_decimals: 0
lambda: |-
return id(wake_up_reason1);
# on_value:
# then:
# - if:
# condition:
# lambda: 'return id(wake_up_reason) == 4;'
# then:
# - logger.log: "4, yellow wire touched"
# else:
# - logger.log: "Non-yellow wire touched"
binary_sensor:
- platform: gpio
pin:
number: GPIO13
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 13 (yellow)"
id: tkm_test_13
- platform: gpio
pin:
number: GPIO12
mode: INPUT_PULLUP
name: "TKM Test 12 (orange)"
id: tkm_test_12
- platform: gpio
pin:
number: GPIO15
mode: INPUT_PULLUP
name: "TKM Test 15 (green)"
id: tkm_test15