Changing LR Brightness to MQTT in YAML

This commit is contained in:
2021-04-22 07:14:51 -04:00
parent 7557040af5
commit e64dc70d1d
5 changed files with 52 additions and 90 deletions

View File

@@ -1,100 +1,28 @@
substitutions:
device_name: bedroom_tkm1
device_ip: 192.168.87.36
esphome:
name: bedroom_tkm1
name: ${device_name}
platform: ESP32
board: wemos_d1_mini32 #esp-wrover-kit
on_boot:
- priority: 900 #900 tried down to 500
then:
- lambda: |-
id(wake_up_reason) = esp_sleep_get_ext1_wakeup_status();
# - priority: 901 #900 tried down to 500
# then:
# - lambda: |-
# esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
# gpio_pullup_dis(GPIO_NUM_33);
# gpio_pulldown_en(GPIO_NUM_33);
# gpio_pullup_dis(GPIO_NUM_34);
# gpio_pulldown_en(GPIO_NUM_34);
# gpio_pullup_dis(GPIO_NUM_35);
# gpio_pulldown_en(GPIO_NUM_35);
wifi:
ssid: "Meneely"
password: "punxsutawney1"
manual_ip:
static_ip: 192.168.87.36
gateway: 192.168.86.1
subnet: 255.255.254.0
fast_connect: True
# captive_portal:
<<: !include standard_wifi.yaml
logger:
level: INFO
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
# <<: !include standard_mqtt_deepsleep.yaml
deep_sleep:
run_duration: 20s
sleep_duration: 40s #24h
esp32_ext1_wakeup:
pins:
- 33 #yellow
- 34 #orange
- 35 #white
mode: ANY_HIGH
run_duration: 12s
sleep_duration: 5min #10s #24h
id: deep_sleep_1
globals:
- id: wake_up_reason
type: int
restore_value: no
initial_value: '0'
# Example configuration entry
sensor:
- platform: template
name: "Remote Control Wake Reason"
accuracy_decimals: 0
lambda: |-
return id(wake_up_reason);
binary_sensor:
- platform: gpio
pin:
number: GPIO33
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 33 (yellow)"
id: tkm_test_33
- platform: gpio
pin:
number: GPIO34
mode: INPUT_PULLUP
name: "TKM Test 34 (orange)"
id: tkm_test_34
- platform: gpio
pin:
number: GPIO35
mode: INPUT_PULLUP
name: "TKM Test 35 (white)"
id: tkm_test_35
- platform: adc
pin: 34
name: "Living Room Brightness"
update_interval: 5s
id: lr_bright01
attenuation: 11db