--- /dev/null
+# Gitignore settings for ESPHome
+# This is an example and may include too much for your use-case.
+# You can modify this file to suit your needs.
+/.esphome/
+**/.pioenvs/
+**/.piolibdeps/
+**/lib/
+**/src/
+**/platformio.ini
+/secrets.yaml
--- /dev/null
+######################################################################
+# Substitutions
+######################################################################
+substitutions:
+ esp01_topic: "esphome/esp01"
+ esp01_version: "00.02-ro"
+ vitality_message: "hello, i'm alive!"
+
+######################################################################
+# ESPHome Configuration
+######################################################################
+esphome:
+ name: esp01-ro
+ comment: "Test esp01 relay only"
+ platform: ESP8266
+ board: esp01_1m
+
+######################################################################
+# WiFi
+######################################################################
+wifi:
+ ssid: !secret wifi_ssid
+ password: !secret wifi_password
+ domain: !secret domain
+
+ # Enable fallback hotspot (captive portal) in case wifi connection fails
+ ap:
+ ssid: "Esp01 Fallback Hotspot"
+ password: !secret hotspot_password
+
+captive_portal:
+
+# Enable logging
+#logger:
+
+# Enable Home Assistant API
+api:
+ password: !secret api_password
+
+ota:
+ password: !secret ota_password
+
+######################################################################
+# Web Server
+######################################################################
+web_server:
+ port: 80
+ auth:
+ username: !secret web_user
+ password: !secret web_password
+
+######################################################################
+# Switch
+######################################################################
+switch:
+ - platform: gpio
+ name: "Relay"
+ id: relay
+ internal: false
+ pin: GPIO0
+ inverted: yes
+ restore_mode: ALWAYS_OFF
+
+######################################################################
+# Text Sensor
+######################################################################
+text_sensor:
+ - platform: version
+ name: "ESPHome Version"
+ icon: mdi:chip
+
+ - platform: template
+ name: "Application Version"
+ icon: mdi:chip
+ lambda: |-
+ return {"$esp01_version"};
# Substitutions
######################################################################
substitutions:
+ esp01_hostname: "esp01"
esp01_topic: "esphome/esp01"
- esp01_version: "00.01"
+ esp01_version: "00.02-full"
vitality_message: "hello, i'm alive!"
+ update_interval: 120s
######################################################################
# ESPHome Configuration
######################################################################
esphome:
- name: esp01
- comment: "Test esp01"
+ name: $esp01_hostname
+ comment: "Test $esp01_hostname full version"
platform: ESP8266
board: esp01_1m
captive_portal:
# Enable logging
-logger:
+#logger:
# Enable Home Assistant API
#api:
topic: '$esp01_topic/status'
payload: offline
on_message:
+ - topic: $esp01_topic/switch/relay/command
+ qos: 0
+ then:
+ - if:
+ condition:
+ lambda: 'return (x=="on");'
+ then:
+ - switch.turn_on: relay
+ - if:
+ condition:
+ lambda: 'return (x=="off");'
+ then:
+ - switch.turn_off: relay
+ - if:
+ condition:
+ lambda: 'return (x=="toggle");'
+ then:
+ - switch.toggle: relay
- topic: $esp01_topic/switch/led/command
qos: 0
then:
# Switch
######################################################################
switch:
+ - platform: gpio
+ name: "Relay"
+ id: relay
+ internal: false
+ pin: GPIO0
+ inverted: yes
+ restore_mode: ALWAYS_OFF
+ #state_topic: esp/esp01/relay/status
+
- platform: gpio
name: "Led"
id: led
internal: false
pin: GPIO2
inverted: yes
- restore_mode: ALWAYS_ON
+ restore_mode: ALWAYS_OFF
#state_topic: esp/esp01/led/status
- platform: template
sensor:
- platform: wifi_signal
name: "WiFi Signal"
- update_interval: 60s
+ update_interval: $update_interval
######################################################################
# Text Sensor
icon: mdi:chip
lambda: |-
return {"$esp01_version"};
- update_interval: 60s
+ update_interval: $update_interval
######################################################################
# Interval
######################################################################
interval:
- - interval: 60sec
+ - interval: $update_interval
then:
- script.execute: mqtt_update_msg