---
substitutions:
devicename: "nodemcu-22"
id_name: nodemcu_22
Device_Location: "Spare Sensor"
update_interval: !secret d1-update_interval
ipaddress: 10.0.0.32
unique_id: "nodemcu-22"
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
# Enable Home Assistant API
api:
encryption:
key: !secret mogwai_api_key
ota:
platform: esphome
password: !secret mogwai_ota_key
captive_portal:
<<: !include common/nodemcu-led-onboard-both-mqtt.yaml
<<: !include common/time.yaml
<<: !include common/website.yaml
<<: !include common/wifi1.yaml
<<: !include common/uptime_formatted.yaml
esphome:
name: $devicename
friendly_name: "NodeMCU-22 - Spare Sensor"
on_boot:
then:
- switch.turn_off: led_onboard1
- switch.turn_off: led_onboard2
switch:
- platform: gpio
pin: D3
name: "Buzzer"
id: buzzerswitch
restore_mode: ALWAYS_ON
- <<: !include common/nodemcu-led-onboard1.yaml
- <<: !include common/nodemcu-led-onboard2.yaml
- <<: !include common/restart.yaml
interval:
- interval: 2s
then:
if:
condition:
and:
- switch.is_on: buzzerswitch
- sensor.in_range:
id: smk
above: 30
then:
- rtttl.play: 'siren:d=16,o=6,b=800:b'
- <<: !include common/version-interval.yaml
- <<: !include common/whatami.yaml
sensor:
- platform: adc
pin: A0
name: "Smoke sensor"
id: smk
update_interval: 1s
filters:
- multiply: 100
unit_of_measurement: "%"
icon: "mdi:percent"
- <<: !include common/wifi2.yaml
- <<: !include common/uptime.yaml
text_sensor:
- <<: !include common/version.yaml
<<: !include common/external-heapmon.yaml
output:
- platform: esp8266_pwm
pin: D1
id: buzzer_output
rtttl:
output: buzzer_output