---
substitutions:
devicename: "nodemcu-19"
id_name: nodemcu_19
Device_Location: Santa
update_interval: !secret d1-update_interval
ipaddress: 10.0.0.29
unique_id: "nodemcu-01"
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-19 - Santa"
on_boot:
then:
# read the RTC time once when the system boots
- switch.turn_on: chaser
- switch.turn_on: legshuffle
- switch.turn_on: twinkle
- switch.turn_on: solid
switch:
# - <<: !include common/led-onboard.yaml
# - <<: !include common/led-onboard2.yaml
- <<: !include common/restart.yaml
- platform: gpio
pin: D0
id: solid
name: "01 - Solid Leds "
inverted: True
- platform: gpio
pin: D3
id: twinkle_pin1
inverted: True
- platform: gpio
pin: D4
id: twinkle_pin2
inverted: True
- platform: template
name: "02 - Twinkle Stars"
optimistic: True
id: twinkle
turn_on_action:
- while:
condition:
lambda: 'return true;'
then:
- switch.turn_on: twinkle_pin1
- switch.turn_off: twinkle_pin2
- delay: 50ms
- switch.turn_off: twinkle_pin1
- switch.turn_on: twinkle_pin2
- delay: 50ms
turn_off_action:
- switch.turn_off: twinkle_pin1
- switch.turn_off: twinkle_pin2
- platform: gpio
pin: D5
id: leg_pin1
inverted: True
- platform: gpio
pin: D6
id: leg_pin2
inverted: True
- platform: template
name: "03 - Leg Shuffle"
optimistic: True
id: legshuffle
turn_on_action:
- while:
condition:
lambda: 'return true;'
then:
- switch.turn_on: leg_pin1
- switch.turn_off: leg_pin2
- delay: 500ms
- switch.turn_off: leg_pin1
- switch.turn_on: leg_pin2
- delay: 500ms
turn_off_action:
- switch.turn_off: leg_pin1
- switch.turn_off: leg_pin2
- platform: gpio
pin: D7
id: chaser1_pin
inverted: True
- platform: gpio
pin: D1
id: chaser2_pin
inverted: True
- platform: gpio
pin: D2
id: chaser3_pin
inverted: True
- platform: template
name: "04 - Chaser Lights"
optimistic: True
id: chaser
turn_on_action:
- while:
condition:
lambda: 'return true;'
then:
- switch.turn_off: chaser1_pin
- switch.turn_off: chaser2_pin
- switch.turn_on: chaser3_pin
- delay: 500ms
- switch.turn_off: chaser1_pin
- switch.turn_on: chaser2_pin
- switch.turn_off: chaser3_pin
- delay: 500ms
- switch.turn_on: chaser1_pin
- switch.turn_off: chaser2_pin
- switch.turn_off: chaser3_pin
- delay: 500ms
turn_off_action:
- switch.turn_off: chaser1_pin
- switch.turn_off: chaser2_pin
- switch.turn_off: chaser3_pin
interval:
- <<: !include common/version-interval.yaml
- <<: !include common/whatami.yaml
<<: !include common/external-heapmon.yaml
sensor:
- <<: !include common/wifi2.yaml
- <<: !include common/uptime.yaml
- <<: !include common/free_space.yaml
text_sensor:
- <<: !include common/version.yaml
mqtt:
id: mqtt_client
broker: 10.0.1.50
discovery_object_id_generator: device_name
discovery_retain: False
discovery: False
topic_prefix: /sensors/$devicename
# on_message:
# - topic: /sensors/$devicename/ota_mode
# payload: 'ONB'
# then:
# - switch.turn_on: led_onboard
# - topic: /sensors/$devicename/ota_mode
# payload: 'OFF'
# then:
# - switch.turn_off: led_onboard
# - topic: /sensors/all-sensors/ota
# payload: 'OFF'
# then:
# - switch.turn_off: led_onboard
# - topic: /sensors/all-sensors/ota
# payload: 'ONB'
# then:
# - switch.turn_on: led_onboard
# - topic: /sensors/$devicename/ota_mode
# payload: 'SANTA'
# then:
# - switch.turn_on: chaser
# - switch.turn_on: legshuffle
# - switch.turn_on: twinkle
# - switch.turn_on: solid
# - topic: /sensors/$devicename/ota_mode
# payload: 'SANTA-OFF'
# then:
# - switch.turn_off: chaser
# - switch.turn_off: legshuffle
# - switch.turn_off: twinkle
# - switch.turn_off: solid
<<: !include common/time-sntp.yaml
<<: !include common/website.yaml
<<: !include common/wifi1.yaml
<<: !include common/uptime_formatted.yaml