Wait for RPC Shutdown

Hi, i got an input_boolean and i attached automations to its on/off states which when turned on it activates a switch, turns on my pc and air conditioner, when turned off shuts down my pc by rpc_shutdown and air conditioner. I need to find a way to turn off switch after pc successfully shuts down…

I can put a couple of minutes delay to turn switch off after rpc_shutdown command but that might cause trouble in the future when windows updates takes longer than delay time…

I also thought of using switches energy_meter attribute to check for current usage and when it drops below 100watt then turn it off, but i cant use that method in the same “off” automation because of condition requirements if i want to use this way it requires to be in its own automation as far as i can understand and i believe that would be more messy…

Can anyone show me a proper way of doing this? Possibly turning a switch after its attribute goes below a threshold by just using actions side in automations…