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

94
sonoff_mini1.yaml Normal file
View File

@@ -0,0 +1,94 @@
substitutions:
device_name: sonoffmini_1
device_ip: 192.168.87.41
esphome:
name: ${device_name}
platform: ESP8266
board: esp01_1m
wifi:
ssid: "Meneely"
password: "punxsutawney1"
manual_ip:
static_ip: ${device_ip}
gateway: 192.168.86.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "ESPHOME"
password: "12345678"
logger:
api:
reboot_timeout: 15min
ota:
# the web_server & sensor components can be removed without affecting core functionaility.
web_server:
port: 80
sensor:
- platform: wifi_signal
name: ${device_name} Wifi Signal Strength
update_interval: 60s
- platform: uptime
name: ${device_name} Uptime
#######################################
# Device specific Config Begins Below #
#######################################
binary_sensor:
- platform: gpio
pin: GPIO00
id: reset
internal: true
filters:
- invert:
- delayed_off: 10ms
on_press:
- switch.toggle:
id: relay_1
- platform: gpio
name: ${device_name}_status
pin: GPIO04
id: switch_1
on_press:
then:
- switch.toggle:
id: relay_1
on_release:
then:
- switch.toggle:
id: relay_1
switch:
- platform: gpio
name: ${device_name}_switch
icon: "mdi: lightbulb_outline"
pin: GPIO12
id: relay_1
restore_mode: restore_default_off
status_led:
pin:
number: GPIO13
inverted: true
output:
- platform: esp8266_pwm
id: blue_led
pin: GPIO13
inverted: True
light:
# the 4 lines below define the Blue LED light on Sonoff Mini, to expose in HomeAssistant remove line "internal: true"
- platform: monochromatic
name: ${device_name}_blueled
output: blue_led
internal: true # hides the Blue LED from HomeAssistant

94
sonoff_mini2.yaml Normal file
View File

@@ -0,0 +1,94 @@
substitutions:
device_name: sonoffmini_2
device_ip: 192.168.87.42
esphome:
name: ${device_name}
platform: ESP8266
board: esp01_1m
wifi:
ssid: "Meneely"
password: "punxsutawney1"
manual_ip:
static_ip: ${device_ip}
gateway: 192.168.86.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "ESPHOME"
password: "12345678"
logger:
api:
reboot_timeout: 15min
ota:
# the web_server & sensor components can be removed without affecting core functionaility.
web_server:
port: 80
sensor:
- platform: wifi_signal
name: ${device_name} Wifi Signal Strength
update_interval: 60s
- platform: uptime
name: ${device_name} Uptime
#######################################
# Device specific Config Begins Below #
#######################################
binary_sensor:
- platform: gpio
pin: GPIO00
id: reset
internal: true
filters:
- invert:
- delayed_off: 10ms
on_press:
- switch.toggle:
id: relay_1
- platform: gpio
name: ${device_name}_status
pin: GPIO04
id: switch_1
on_press:
then:
- switch.toggle:
id: relay_1
on_release:
then:
- switch.toggle:
id: relay_1
switch:
- platform: gpio
name: ${device_name}_switch
icon: "mdi: lightbulb_outline"
pin: GPIO12
id: relay_1
restore_mode: restore_default_off
status_led:
pin:
number: GPIO13
inverted: true
output:
- platform: esp8266_pwm
id: blue_led
pin: GPIO13
inverted: True
light:
# the 4 lines below define the Blue LED light on Sonoff Mini, to expose in HomeAssistant remove line "internal: true"
- platform: monochromatic
name: ${device_name}_blueled
output: blue_led
internal: true # hides the Blue LED from HomeAssistant