Compare commits

..

18 Commits
dev ... main

Author SHA1 Message Date
Andrej Friesen 41fb978bef Add checkout 2024-02-13 19:32:39 +01:00
Andrej Friesen bf9d1b9788 Add binary build for esphome 2024-02-13 19:30:47 +01:00
Andrej Friesen 5ce03c462f Remove dependabot 2024-02-13 19:30:32 +01:00
Andrej Friesen b23a4f6015 Remove github pages 2024-02-13 00:34:58 +01:00
Andrej Friesen 0b5d6bc0cc Fix double pin usage
The first attempt to just allow using the twin twice was not the right
approach.
Now we just define the pins once and use tempalte switches.
2024-02-09 22:35:46 +01:00
Andrej Friesen f359b1c5b5 Add wifi signal sensor 2024-02-09 22:22:20 +01:00
Andrej Friesen 0dcec55a91 Add webserver 2024-02-09 22:22:01 +01:00
Andrej Friesen 0ade490995 Remove docs folder
Docs will be moved here:
https://github.com/ajfriesen/pc-switch-website
2024-02-09 22:16:55 +01:00
Andrej Friesen a6bd4ad926
Update for new esphome version
The new version introduced the `allow_other_uses: true` flag if you use a pin twice.
This needs to be set.
2024-01-11 09:10:30 +01:00
Andrej Friesen 59214309b8 Add firmware 2023-02-14 00:22:43 +01:00
Andrej Friesen c4fb78df3f remove git metadata 2023-02-14 00:21:49 +01:00
Andrej Friesen b8234eac8d Upadte .gitignore 2023-02-12 13:50:14 +01:00
Andrej Friesen d800069531 Add hugo docs 2023-02-12 13:50:00 +01:00
Andrej Friesen 8d473183f9
Add MIT license 2022-12-19 12:59:25 +01:00
Andrej Friesen 43a8ccfc61 Update readme 2022-11-10 09:39:39 +01:00
Andrej Friesen a590241f07 Remove forum link
Does not exst anymore
2022-11-10 09:33:02 +01:00
ajfriesen e8b3801ba5 Update pc-switch.yaml 2022-09-21 23:27:15 +02:00
Andrej Friesen 8ea9a64196 Update project 2022-03-20 17:06:24 +01:00
8 changed files with 102 additions and 48 deletions

15
.github/workflows/esphome.yaml vendored Normal file
View File

@ -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

5
.gitignore vendored Normal file
View File

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

21
LICENSE.md Normal file
View File

@ -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.

View File

@ -1,49 +1,29 @@
# pc-switch
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](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.
![Prototype](images/pc-switch-home-assistant-gui.png)
![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.
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 to power on your PC
- No funky magic packets anymore with wake on LAN (never worked for me)
- 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)
- No addons with admin access (password) to your Windows PC
- 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
![Version 1.0 assembled](images/v1.0-assembled.jpg)
![PCB Version 1.0](images/v1.0.jpg)
![Prototype](images/prototype.jpg)
## Parts
# Project Documentation
- Optocoupler: EL817
- Resistor:
- ESP8266-12F from AZDelivery
You can find all product documentation, related blog post on my dedicated [pc-switch website](https://www.ajfriesen.com/pc-switch/).
## 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

BIN
images/v1.0-assembled.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

BIN
images/v1.0.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 KiB

View File

@ -1,17 +1,28 @@
substitutions:
name: "pc"
uppercase_name: "PC"
esphome:
name: pc-switch
name: "${name}"
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:
@ -25,41 +36,63 @@ 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
on_turn_on:
- delay: 300ms
- switch.turn_off: power_switch
turn_on_action:
- switch.turn_on: power_pin
- delay: 300ms
- switch.turn_off: power_pin
- platform: gpio
pin: D6
- platform: template
name: "Power Switch Force"
id: power_switch_force
internal: true
on_turn_on:
- delay: 5000ms
- switch.turn_off: power_switch_force
turn_on_action:
- switch.turn_on: power_pin
- delay: 5000ms
- switch.turn_off: power_pin
- platform: gpio
pin: D7
id: reset_pin
internal: true
- platform: template
name: "Reset Switch"
id: reset_switch
on_turn_on:
- delay: 300ms
- switch.turn_off: reset_switch
internal: true
turn_on_action:
- switch.turn_on: reset_pin
- delay: 300ms
- switch.turn_off: reset_pin
binary_sensor:
- platform: gpio
pin: D0
id: pc_power_sensor
name: "PC Power State"
name: "${name} Power State"
device_class: power
icon: "mdi:desktop-classic"
button:
- platform: template
name: "PC Power Button"
name: "${name} Power Button"
id: power_button
icon: "mdi:power-standby"
on_press:
@ -67,7 +100,7 @@ button:
- switch.toggle: power_switch
- platform: template
name: "PC Force Power Off"
name: "${name} Force Power Off"
id: force_power_off
icon: "mdi:power-plug-off"
on_press:
@ -75,7 +108,7 @@ button:
- switch.toggle: power_switch_force
- platform: template
name: "PC Reset Button"
name: "${name} Reset Button"
id: reset_button
icon: "mdi:restart"
on_press: