Add esphome example config

This commit is contained in:
Jonttuuu 2023-09-02 20:31:07 +03:00
parent 5e85b0201c
commit c67a447cc9

111
esphome-config-example.yaml Normal file
View File

@ -0,0 +1,111 @@
esphome:
name: esphome-smart-pc
friendly_name: SmartPC
esp8266:
board: nodemcuv2
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: ""
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-PC"
password: "password"
captive_portal:
binary_sensor:
- platform: gpio
id: power_sensor
name: "Power"
pin:
number: 12
mode:
input: true
pullup: true
on_press:
then:
- if:
condition:
light.is_on: led_strip
then:
- light.turn_on: led_strip
button:
- platform: template
name: "Power"
icon: "mdi:power"
on_press:
then:
- switch.turn_on: power_relay
- delay: 500ms
- switch.turn_off: power_relay
- platform: template
name: "Reset"
icon: "mdi:power-cycle"
on_press:
then:
- if:
condition:
binary_sensor.is_on: power_sensor
then:
- switch.turn_on: power_relay
- delay: 6000ms
- switch.turn_off: power_relay
switch:
- platform: template
name: Sata switch
icon: "mdi:harddisk"
lambda: |-
return id(sata_relay).state;
turn_on_action:
then:
- if:
condition:
binary_sensor.is_off: power_sensor
then:
- switch.turn_on: sata_relay
turn_off_action:
- if:
condition:
binary_sensor.is_off: power_sensor
then:
- switch.turn_off: sata_relay
- platform: gpio
pin: 5
id: sata_relay
internal: true
- platform: gpio
pin: 4
id: power_relay
internal: true
restore_mode: RESTORE_DEFAULT_OFF
light:
- platform: neopixelbus
id: led_strip
type: GRB
variant: WS2811
pin: 2
num_leds: 60
name: "Leds"
effects:
- random:
name: "Random"
transition_length: 4s
update_interval: 5s
- addressable_rainbow: