From c67a447cc98ecc3a02aebebe8b70eb3556f9ef4b Mon Sep 17 00:00:00 2001 From: Jonttuuu <50843099+Jonttuuu@users.noreply.github.com> Date: Sat, 2 Sep 2023 20:31:07 +0300 Subject: [PATCH] Add esphome example config --- esphome-config-example.yaml | 111 ++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 esphome-config-example.yaml diff --git a/esphome-config-example.yaml b/esphome-config-example.yaml new file mode 100644 index 0000000..e83e079 --- /dev/null +++ b/esphome-config-example.yaml @@ -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: