Compare commits
18 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
41fb978bef | |
|
|
bf9d1b9788 | |
|
|
5ce03c462f | |
|
|
b23a4f6015 | |
|
|
0b5d6bc0cc | |
|
|
f359b1c5b5 | |
|
|
0dcec55a91 | |
|
|
0ade490995 | |
|
|
a6bd4ad926 | |
|
|
59214309b8 | |
|
|
c4fb78df3f | |
|
|
b8234eac8d | |
|
|
d800069531 | |
|
|
8d473183f9 | |
|
|
43a8ccfc61 | |
|
|
a590241f07 | |
|
|
e8b3801ba5 | |
|
|
8ea9a64196 |
|
|
@ -0,0 +1,15 @@
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
docs/public
|
||||||
|
docs/resources/
|
||||||
|
docs/node_modules/
|
||||||
|
docs/package-lock.json
|
||||||
|
docs/.hugo_build.lock
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
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.
|
||||||
42
README.md
42
README.md
|
|
@ -1,49 +1,29 @@
|
||||||
# pc-switch
|
# pc-switch
|
||||||
|
|
||||||
[](https://ko-fi.com/ajfriesen)
|
Remote shutdown and start you PC/server with Home Assistant.
|
||||||
|
|
||||||
ESPHome powered switch to turn on/off your PC.
|
Powered by ESPHome.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
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
|
## 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
|
- 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 to power on your PC
|
- 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 wake on LAN (never worked for me)
|
- No funky magic packets anymore with flaky wake on LAN (never worked for me)
|
||||||
- No addons with admin access (password) to your Windows PC
|
- No addons with admin access (password) to your Windows PC
|
||||||
- Add voice commands via Home Assistant to Google Assistant
|
- Add voice commands via Home Assistant to Google Assistant
|
||||||
|
|
||||||
## 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
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Parts
|
# Project Documentation
|
||||||
|
|
||||||
- Optocoupler: EL817
|
You can find all product documentation, related blog post on my dedicated [pc-switch website](https://www.ajfriesen.com/pc-switch/).
|
||||||
- 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: 3.9 MiB After Width: | Height: | Size: 211 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 137 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 629 KiB |
|
|
@ -1,17 +1,28 @@
|
||||||
|
substitutions:
|
||||||
|
name: "pc"
|
||||||
|
uppercase_name: "PC"
|
||||||
|
|
||||||
|
|
||||||
esphome:
|
esphome:
|
||||||
name: pc-switch
|
name: "${name}"
|
||||||
platform: ESP8266
|
platform: ESP8266
|
||||||
board: nodemcuv2
|
board: nodemcuv2
|
||||||
|
|
||||||
|
project:
|
||||||
|
name: "ajfriesen.pc-switch"
|
||||||
|
version: "1.0.1"
|
||||||
|
|
||||||
# Enable logging
|
# Enable logging
|
||||||
logger:
|
logger:
|
||||||
|
|
||||||
# Enable Home Assistant API
|
# Enable Home Assistant API
|
||||||
api:
|
api:
|
||||||
|
|
||||||
|
dashboard_import:
|
||||||
|
package_import_url: github://ajfriesen/pc-switch/pc-switch.yaml@main
|
||||||
|
|
||||||
# Put ota password here
|
# Put ota password here
|
||||||
ota:
|
ota:
|
||||||
password: ""
|
|
||||||
|
|
||||||
# Your wifi config
|
# Your wifi config
|
||||||
wifi:
|
wifi:
|
||||||
|
|
@ -25,41 +36,63 @@ wifi:
|
||||||
|
|
||||||
captive_portal:
|
captive_portal:
|
||||||
|
|
||||||
|
web_server:
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: "pc-switch WiFi Signal"
|
||||||
|
update_interval: 60s
|
||||||
|
|
||||||
switch:
|
switch:
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
pin: D6
|
pin: D6
|
||||||
|
id: power_pin
|
||||||
|
internal: true
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
name: "Power Switch"
|
||||||
id: power_switch
|
id: power_switch
|
||||||
internal: true
|
internal: true
|
||||||
on_turn_on:
|
turn_on_action:
|
||||||
- delay: 300ms
|
- switch.turn_on: power_pin
|
||||||
- switch.turn_off: power_switch
|
- delay: 300ms
|
||||||
|
- switch.turn_off: power_pin
|
||||||
|
|
||||||
- platform: gpio
|
- platform: template
|
||||||
pin: D6
|
name: "Power Switch Force"
|
||||||
id: power_switch_force
|
id: power_switch_force
|
||||||
internal: true
|
internal: true
|
||||||
on_turn_on:
|
turn_on_action:
|
||||||
- delay: 5000ms
|
- switch.turn_on: power_pin
|
||||||
- switch.turn_off: power_switch_force
|
- delay: 5000ms
|
||||||
|
- switch.turn_off: power_pin
|
||||||
|
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
pin: D7
|
pin: D7
|
||||||
|
id: reset_pin
|
||||||
|
internal: true
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
name: "Reset Switch"
|
||||||
id: reset_switch
|
id: reset_switch
|
||||||
on_turn_on:
|
internal: true
|
||||||
- delay: 300ms
|
turn_on_action:
|
||||||
- switch.turn_off: reset_switch
|
- switch.turn_on: reset_pin
|
||||||
|
- delay: 300ms
|
||||||
|
- switch.turn_off: reset_pin
|
||||||
|
|
||||||
binary_sensor:
|
binary_sensor:
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
pin: D0
|
pin: D0
|
||||||
id: pc_power_sensor
|
id: pc_power_sensor
|
||||||
name: "PC Power State"
|
name: "${name} Power State"
|
||||||
device_class: power
|
device_class: power
|
||||||
icon: "mdi:desktop-classic"
|
icon: "mdi:desktop-classic"
|
||||||
|
|
||||||
button:
|
button:
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "PC Power Button"
|
name: "${name} Power Button"
|
||||||
id: power_button
|
id: power_button
|
||||||
icon: "mdi:power-standby"
|
icon: "mdi:power-standby"
|
||||||
on_press:
|
on_press:
|
||||||
|
|
@ -67,7 +100,7 @@ button:
|
||||||
- switch.toggle: power_switch
|
- switch.toggle: power_switch
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "PC Force Power Off"
|
name: "${name} Force Power Off"
|
||||||
id: force_power_off
|
id: force_power_off
|
||||||
icon: "mdi:power-plug-off"
|
icon: "mdi:power-plug-off"
|
||||||
on_press:
|
on_press:
|
||||||
|
|
@ -75,7 +108,7 @@ button:
|
||||||
- switch.toggle: power_switch_force
|
- switch.toggle: power_switch_force
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "PC Reset Button"
|
name: "${name} Reset Button"
|
||||||
id: reset_button
|
id: reset_button
|
||||||
icon: "mdi:restart"
|
icon: "mdi:restart"
|
||||||
on_press:
|
on_press:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue