Turn ON PC with Sonoff Mod

I have a Sonoff switch that I modded to turn the PC switch ON/OFF after turning ON the PSU.

It basically works like that: The Sonoff switch is connected to 5vsb+ PSU line, when I turn the PSU ON, the Sonoff switch takes some time to connect to Wifi (something around 5 to 15 seconds), what I want is to automate that switch, as soon as I turn ON the PSU and the Sonoff is connected to Wifi to turn the computer ON.

Right now is working as intendend, but I’ve used a timer to do that, so it takes to long to turn it ON.

I’ve tried creating an automation but it did not work:

id: '1634144967188'
alias: Teste
description: ''
- platform: state
entity_id: switch.computador_1
from: 'off'
to: 'on'
- condition: and
- condition: state
entity_id: switch.100116085d
state: unknown
- condition: state
entity_id: switch.100116085d
attribute: state
state: 'on'
mode: single

Any help ?