commit 0d33904f887114c7730498821a18e354ef55b87f Author: Andrej Friesen Date: Sun Sep 26 15:34:48 2021 +0200 Initial commit 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 +