Esp Home Button activate alone 1 minute after press

Hi everyone !

I have bought this pcb : eWeLink PCIe Computer Remote (SANT-SUD01) | devices.esphome.io wich I have flashed with ESPHome, using this yaml file :

status_led:
  pin:
    number: GPIO13
    inverted: True

button:
  - platform: template
    name: "Allumer mon PC"
    id: sw_pc_power
    on_press:
      - output.turn_on: out_relay
      - delay: 0.5s
      - output.turn_off: out_relay

output:
  - platform: gpio
    id: out_relay
     pin: GPIO12

The problem is that after every press of the HA button, the code works well, turning on my computer. But exactly 1 minute after, the relay activate for like 6 / 7 seconds, turning off my PC.

Nothing interesting can be found in the log, even when VERY_VERBOSE is activated and even in the ESPHome HA log.

Have you an Idea of why it does that ?

Thank you for your help !

Bonjour! The bottom of the page you’ve linked to, shows the following code. Notice the comment:

output:
  - platform: gpio
    id: out_relay
    #Inverts relay operation, this avoids force shutdown behavior on some motherboards. Uncomment here and replace the above lambda if you are having this problem.
    #inverted: True
    pin: GPIO12

Did you try that? Also, it looks like the script in there is slightly more complicated, with some additional logic to ensure proper functioning of the button. I would actually suggest to try the script as-is, and try with the inverted option (notice you’ll also need to uncomment/replace another piece of code if you use the inverted logic).

1 Like

Thank you for your reply,
I have already tried the full script, even the inverted option, but with no success. I have only simplified the script to chase down what is going wrong.

I finally posted the problem here because even with the simpliest script possible, the problem was still there ! And I’m not able to understand how to make this work…

Is that all of the code in tour esphome config?
Is out_relay what toggles the pc power?

1 Like

No, there is the base configuration that ESPHome put automatically. Here is the full .yaml file is that could be helpfull …

esphome:
  name: pc-tour-switch
  friendly_name: PC tour switch

esp8266:
  board: esp8285

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "..."

ota:
  password: "..."

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Pc-Tour-Switch Fallback Hotspot"
    password: "..."

captive_portal:

status_led:
  pin:
    number: GPIO13
    inverted: True

button:
  - platform: template
    name: "Allumer mon PC"
    id: sw_pc_power
    on_press:
      - output.turn_on: out_relay
      - delay: 0.5s
      - output.turn_off: out_relay

output:
  - platform: gpio
    id: out_relay
    pin: GPIO12

Yes, out_relay is the output triggering my pc power switch

Ya, I dont know about this one. It does specifically say that, " The configuration below covers just the basics for getting the core functionality (turning PC on/off and seeing its status) usable in ESPHome. Depending on your specific needs, more configuration may be needed. E.G.: most motherboards will interpret the power button being pressed for 5+ seconds to mean "shutdown now ".

Id say youmay need to get your multimeter out and watch the state(voltage) of the power button to see what its doing. I mean, I’m not a PC expert or going to pretend to know all the ways a motherboard and power button communicate back and forth. It sounds like they configured it to work with a standard motherboard/power button config but, yours may not operate the same way and you are one of the, " may need more configuration people/PC’s"

I would break out the multimeter and watch GPIO0 to see what its doing and what on/off signals its sending in the backround.

1 Like

Contacting the manufacturer or vendor is always a good route to try too.

1 Like

Thank you, I will look into it

Maybe try a different pin out for the relay. 4, 5, or 14

1 Like

maybe you should look at the hardware in question and then let explain switching gpio pins.

1 Like

Maybe you should read up on 0-10V analog signal and stop being a troll.

Maybe you should stay on topic and learn how to properly articulate a question if you dont want people to make assumptions. You act like im the one at fault when you reference specific hardware in vague terms and dont distinguish your question is in reference to constant current or constant voltage which i can only assume the reason is because you dont know the difference or esle you wouldnt make such an amateur mistake. This isnt hard stuff to comprehend, pick up a book once in a while and educate yourself or keep coming at me and ill put you in your place.