From 0d33904f887114c7730498821a18e354ef55b87f Mon Sep 17 00:00:00 2001 From: Andrej Friesen Date: Sun, 26 Sep 2021 15:34:48 +0200 Subject: [PATCH] Initial commit --- README.md | 4 ++++ esphome.yaml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 README.md create mode 100644 esphome.yaml diff --git a/README.md b/README.md new file mode 100644 index 0000000..d75e6eb --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# pc-switch + +ESPHome powered switch to turn on/off your PC. + diff --git a/esphome.yaml b/esphome.yaml new file mode 100644 index 0000000..5202c7b --- /dev/null +++ b/esphome.yaml @@ -0,0 +1,46 @@ +esphome: + name: pc-switch + platform: ESP8266 + board: nodemcuv2 + +# Enable logging +logger: + +# Enable Home Assistant API +api: + +# Put ota password here +ota: + password: "" + +# Your wifi config +wifi: + # ssid: "" + # password: "" + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "PC-Switch Fallback Hotspot" + password: "fallback-wifi" + +captive_portal: + +switch: + - platform: gpio + pin: D6 + id: power + name: "Power toogle" + icon: "mdi:PC" + on_turn_on: + - delay: 300ms + - switch.turn_off: power + + - platform: gpio + pin: D6 + id: force_power + name: "Force power off" + icon: "mdi:PC" + on_turn_on: + - delay: 5000ms + - switch.turn_off: force_power +