Compare commits

..

No commits in common. "main" and "dev" have entirely different histories.
main ... dev

8 changed files with 48 additions and 102 deletions

View File

@ -1,15 +0,0 @@
name: Build Binary
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: esphome/build-action@v1.8.0
with:
yaml_file: pc-switch.yaml

5
.gitignore vendored
View File

@ -1,5 +0,0 @@
docs/public
docs/resources/
docs/node_modules/
docs/package-lock.json
docs/.hugo_build.lock

View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2022 Andrej Friesen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,29 +1,49 @@
# pc-switch
Remote shutdown and start you PC/server with Home Assistant.
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/ajfriesen)
Powered by ESPHome.
ESPHome powered switch to turn on/off your PC.
![Home Assisant Panel](images/pc-switch-home-assistant-gui.png)
Just connect your power, reset and power led front panel connector to appropriate pin pairs, power the ESP8266 and you can turn on and off your PC via Home Assistant.
![Prototype](images/pc-switch-home-assistant-gui.png)
Just connect your power, reset and power led front panel connector to appropieate pin pairs, power the ESP8266 and you can turn on and off your PC via Home Assistant.
## Use cases
- Hide your PC in a closet or on a shelf without the need to press the actual button. You can just connect any other button via home assistant
- Setup automation based on time, motion or the moon phase, or whatever you like to power on your PC
- No funky magic packets anymore with flaky wake on LAN (never worked for me)
- Setup automation based on time, motion or the moon phase to power on your PC
- No funky magic packets anymore with wake on LAN (never worked for me)
- No addons with admin access (password) to your Windows PC
- Add voice commands via Home Assistant to Google Assistant
![Version 1.0 assembled](images/v1.0-assembled.jpg)
## Powersource
### Internal USB port
Most motherboard can deliver power over USB when the PC is off.
Needs to be configure in the BIOS.
### TPM header
Check your motherboard manual for a TPM header.
Also check how much voltage the TPM header can supply.
Then you can connect power and groud from the TPM header to the ESP8266
![PCB Version 1.0](images/v1.0.jpg)
![Prototype](images/prototype.jpg)
# Project Documentation
## Parts
You can find all product documentation, related blog post on my dedicated [pc-switch website](https://www.ajfriesen.com/pc-switch/).
- Optocoupler: EL817
- Resistor:
- ESP8266-12F from AZDelivery
## Todo
- [x] powering the ESP8266
- [x] Power, reset and hard power off switch for PC in Home Assistant
- [x] Protoype on breadboard
- [x] Create first soldered protoype
- [x] Check for PC status
- [ ] Design PCB
- [ ] upload PCB
- [ ] Create 3D printed case
- [ ] Maybe enable MQTT to control this device (without home assistant)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

After

Width:  |  Height:  |  Size: 3.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 629 KiB

View File

@ -1,28 +1,17 @@
substitutions:
name: "pc"
uppercase_name: "PC"
esphome:
name: "${name}"
name: pc-switch
platform: ESP8266
board: nodemcuv2
project:
name: "ajfriesen.pc-switch"
version: "1.0.1"
# Enable logging
logger:
# Enable Home Assistant API
api:
dashboard_import:
package_import_url: github://ajfriesen/pc-switch/pc-switch.yaml@main
# Put ota password here
ota:
password: ""
# Your wifi config
wifi:
@ -36,63 +25,41 @@ wifi:
captive_portal:
web_server:
port: 80
sensor:
- platform: wifi_signal
name: "pc-switch WiFi Signal"
update_interval: 60s
switch:
- platform: gpio
pin: D6
id: power_pin
internal: true
- platform: template
name: "Power Switch"
id: power_switch
internal: true
turn_on_action:
- switch.turn_on: power_pin
- delay: 300ms
- switch.turn_off: power_pin
on_turn_on:
- delay: 300ms
- switch.turn_off: power_switch
- platform: template
name: "Power Switch Force"
- platform: gpio
pin: D6
id: power_switch_force
internal: true
turn_on_action:
- switch.turn_on: power_pin
- delay: 5000ms
- switch.turn_off: power_pin
on_turn_on:
- delay: 5000ms
- switch.turn_off: power_switch_force
- platform: gpio
pin: D7
id: reset_pin
internal: true
- platform: template
name: "Reset Switch"
id: reset_switch
internal: true
turn_on_action:
- switch.turn_on: reset_pin
- delay: 300ms
- switch.turn_off: reset_pin
on_turn_on:
- delay: 300ms
- switch.turn_off: reset_switch
binary_sensor:
- platform: gpio
pin: D0
id: pc_power_sensor
name: "${name} Power State"
name: "PC Power State"
device_class: power
icon: "mdi:desktop-classic"
button:
- platform: template
name: "${name} Power Button"
name: "PC Power Button"
id: power_button
icon: "mdi:power-standby"
on_press:
@ -100,7 +67,7 @@ button:
- switch.toggle: power_switch
- platform: template
name: "${name} Force Power Off"
name: "PC Force Power Off"
id: force_power_off
icon: "mdi:power-plug-off"
on_press:
@ -108,7 +75,7 @@ button:
- switch.toggle: power_switch_force
- platform: template
name: "${name} Reset Button"
name: "PC Reset Button"
id: reset_button
icon: "mdi:restart"
on_press: