I found a nice project how to switch a pc from remote by hardware switch via ESP8266.
I think it should be quite simple. A connection is made by a transistor. So I have to power the transistor to make it connect two cables.
In the project, the trigger is activated via home-assistant. I want to be able to trigger it an easier way, p.ex. by logging in to espeasy and trigger it. How do I manage this? Should be quite simple, I just have no idea.
Power Pin to ground to switch PC power on
Moderators: grovkillen, Stuntteam, TD-er
Re: Power Pin to ground to switch PC power on
Via Home Assistant you can send an MQTT command to the ESPEasy unit that has a HA Controller configured and enabled, to send a gpio,<pin>,<state> command to set the pin to state 0 or 1 to switch your PC. Probably it should only use a pulse (longpulse_ms,<pin>,<state<,<duration>) ,of several hundreds of milliseconds to switch the PC on, that should be enough. 'Pressing' it again will, by default put it in sleep mode, and pressing it long (> 6 seconds) will forcefully switch it off.
/Ton (PayPal.me)
Re: Power Pin to ground to switch PC power on
Maybe better to use WakeOnLan.
When trying to turn on the PC via a transistor, you must be quite sure this switch isn't toggled by accident or else your PC may turn off when you don't want to.
Also you must make sure there isn't a (large or fixed) potential difference between the ESP and the GND pin (or the other power pin on the main board) or else you may fry your main board
When trying to turn on the PC via a transistor, you must be quite sure this switch isn't toggled by accident or else your PC may turn off when you don't want to.
Also you must make sure there isn't a (large or fixed) potential difference between the ESP and the GND pin (or the other power pin on the main board) or else you may fry your main board
Re: Power Pin to ground to switch PC power on
As I said, I want to do it without Homeassistant, but thanks.
I do not want to use WakeOnLan because I want to be able to remotely start my server when it freezes. WakeOnLan does not work then.
It should be rather easy for someone who knows ESP easy.
The important part is this here:
Code: Select all
switch:
- platform: gpio
name: "PC Power Toggle"
icon: "mdi:electric-switch"
pin: D2 # Power button output pin
id: power_short_press
inverted: no
on_turn_on:
- delay: 150ms
- switch.turn_off: power_short_press
Re: Power Pin to ground to switch PC power on
Sure, you can simply add some rules block and then you only need to trigger an event in ESPEasy to perform this action.
Something like this:
See: https://espeasy.readthedocs.io/en/lates ... ernal-gpio
So whenever you trigger the event "pcpower", it will send a pulse of 150 msec to that pin.
I strongly advice you to check this table: https://espeasy.readthedocs.io/en/lates ... on-esp8266
GPIO-4 is perhaps the best pin for this as it will not toggle during boot of the ESP.
However, in ESPEasy it is set as default for one of the I2C pins, so you may need to remove that assignment on the Hardware tab.
Something like this:
Code: Select all
On pcpower Do
LogEntry,'Send pulse to power button PC'
LongPulse_ms,4,1,150 // Activate GPIO-4, active high, for 150 milli seconds
Endon
So whenever you trigger the event "pcpower", it will send a pulse of 150 msec to that pin.
Code: Select all
event,pcpower
GPIO-4 is perhaps the best pin for this as it will not toggle during boot of the ESP.
However, in ESPEasy it is set as default for one of the I2C pins, so you may need to remove that assignment on the Hardware tab.
Who is online
Users browsing this forum: No registered users and 16 guests