---
substitutions:
devicename: nodemcu-10
id_name: nodemcu_10
Device_Location: Lounge Switches
update_interval: !secret d1-update_interval
ipaddress: 10.0.0.20
unique_id: "nodemcu-10"
deep_sleep_interval: !secret deep_sleep_interval
logger:
level: WARN
esp8266:
board: nodemcuv2
wifi:
ssid: !secret mogwai_wifi_name
password: !secret mogwai_wifi_password
<<: !include common/network.yaml
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "$devicename Fallback Hotspot"
password: !secret mogwai_ap_key
api:
encryption:
key: !secret mogwai_api_key
ota:
platform: esphome
password: !secret mogwai_ota_key
captive_portal:
esphome:
name: $devicename
friendly_name: "NodeMCU-10 - Lounge Switches"
on_boot:
then:
- switch.turn_off: led_onboard1
- switch.turn_off: led_onboard2
<<: !include common/nodemcu-led-onboard-both-mqtt.yaml
<<: !include common/time-sntp.yaml
<<: !include common/website.yaml
<<: !include common/wifi1.yaml
<<: !include common/uptime_formatted.yaml
switch:
- <<: !include common/nodemcu-led-onboard1.yaml
- <<: !include common/nodemcu-led-onboard2.yaml
- <<: !include common/restart.yaml
interval:
- <<: !include common/version-interval.yaml
- <<: !include common/whatami.yaml
sensor:
- <<: !include common/wifi2.yaml
- <<: !include common/uptime.yaml
- <<: !include common/free_space.yaml
text_sensor:
- <<: !include common/version.yaml
binary_sensor:
- platform: gpio
on_press:
then:
- mqtt.publish:
topic: cmnd/espmini-01/POWER
payload: "ON"
- mqtt.publish:
topic: cmnd/espmini-02/POWER
payload: "ON"
- mqtt.publish:
topic: cmnd/espmini-03/POWER
payload: "ON"
- mqtt.publish:
topic: cmnd/espmini-04/POWER
payload: "ON"
pin:
number: D6
mode: INPUT_PULLUP
inverted: True
name: "SWITCH1"
filters:
- delayed_on: 10ms
- platform: gpio
on_press:
then:
- mqtt.publish:
topic: cmnd/espmini-01/POWER
payload: "OFF"
- mqtt.publish:
topic: cmnd/espmini-02/POWER
payload: "OFF"
- mqtt.publish:
topic: cmnd/espmini-03/POWER
payload: "OFF"
- mqtt.publish:
topic: cmnd/espmini-04/POWER
payload: "OFF"
pin:
number: D5
mode: INPUT_PULLUP
inverted: True
name: "SWITCH2"
filters:
- delayed_on: 10ms
- platform: gpio
on_press:
then:
- mqtt.publish:
topic: /sensors/all-sensors/ota
payload: "ONB"
pin:
number: D2
mode: INPUT_PULLUP
inverted: True
name: "SWITCH3"
filters:
- delayed_on: 10ms
- platform: gpio
on_press:
then:
- mqtt.publish:
topic: /sensors/all-sensors/ota
payload: "OFF"
pin:
number: D7
mode: INPUT_PULLUP
inverted: True
name: "SWITCH4"
filters:
- delayed_on: 10ms
- platform: gpio
on_press:
then:
- mqtt.publish:
topic: /sensors/nodemcu-12/ota_mode
payload: "ON"
pin:
number: D1
mode: INPUT_PULLUP
inverted: True
name: "SWITCH5"
filters:
- delayed_on: 10ms
- platform: gpio
on_press:
then:
- mqtt.publish:
topic: /sensors/nodemcu-12/ota_mode
payload: "OFF"
pin:
number: D3
mode: INPUT_PULLUP
inverted: True
name: "SWITCH6"
filters:
- delayed_on: 10ms
<<: !include common/external-heapmon.yaml