I have been trying to create a WOL / Shutdown switch for my PC.
I have been partly sucessful.
switch:
- platform: wake_on_lan
name: PC
mac_address: "2c:xx:xx:xx:xx:xx"
host: 192.168.1.112
turn_off:
service: hassio.addon_stdin
data:
addon: core_rpc_shutdown
input: PC
With this code, I am able to turn off the PC, but the WOL wont work. If I remove the code from: turn_off: and all the code below it, I am able to turn the PC on, but of course not turning it off, since that part of the code is missing.
As far as I could see I had postede in the wrong forum. I am new here so wanted to correct that mistanke, but found out I couldnt delete my other post, after I made this one
Still have the problem tho, if anyone is willing to help
The thing is, the shutdown works. But while the code for RPC shutdown is present, I am not able to turn it on. If I remove the RPC part, the WOL works without any problems.
[Info] Read alias: PC
[Info] Shutdown PC -> 192.168.1.112
I have set up RPC Shutdwon PC .its working well through CALL SERVICE . Can you p-lease help me for how to create switch . i paste some code on my configuration.yaml .
but some error showing .find the below images
im struggling with this configuration too! The wake on lan is working and the pc turns on. But the switch on the home assistant is switching back to “off” after a few seconds. Therefore Ive no chance to execute the rpc shutdown. What type of button do you using on the dashboard or how you was able to keep the state to poweron?
It is expected for it to turn on then off again if HA cannot determine that the computer is actually turned on. I don’t recall which method HA is using to determine this.
In the past I have needed to switch my network type in Windows from Public to Home/Private to get the state reporting to function properly.
To test the RPC shutdown command or use it in an automation you can always just use the developer tools or call the service in an automation, regardless of the switch state.