Is it possible to create a single “switch” that could use the command_line platform to turn a device off, and the wake_on_lan platform to turn a device on?
Essentially I’d like a single switch that can turn a server on via wake on lan (have this already), but also turn it off. I was hoping to turn it off by calling a URL that would trigger a sleep/hibernate command I already use on the server itself.
Anyone know if this is possible and if so, what kind of yaml construct would do it?
Thanks! I was just replying to myself to say possibly this, but that it’s so confusing I don’t understand how to use it. I’ll try reading it for the 4th time and have a play.
The only problem I’m seeing is that when turning it on, the switch toggles on, but then off for a while, and then back on. Minor issue though that doesn’t really impact anything. At least I can finally turn it off easily
I am using a program called “sleeponlan” running on my pc that receives the shell command.
I can turn on/off my pc fine. Its just the switch stays on and is not giving me the correct status.
Hope that someone can help. I am trying to create a switch to turn a server on and off.
On is working fine, but the off settings dont seem to work.
Anyone any idea what I am doing wrong?
My configuration checks gives this error:
Invalid config for [shell_command]: [turn_off_Server] is an invalid option for [shell_command]. Check: shell_command->shell_command->turn_off_Server. (See /config/configuration.yaml, line 193). Please check the docs at https://home-assistant.io/components/shell_command/"
are you able to add to wake_on_lan your own additional parameters? I am working on a custom linux script for shutting down different kinds of computers and want to pass parameters to it that aren’t in the manual. So obviously I need “host” or IP but also want to be able to define username and password and also the type of computer like “Windows7” or “Windows10” or “Mac” or “Linux” or whatever that will trigger different shutdown options in the same script.
Can you pass parameters like host to the script in the turn_off: area? Hate to create hard coded shell commands for every one of them.
So for me I have a shell script that takes three parameters right now and is called like:
./shutdown.sh -a parameterA -b parameterB -c parameterC
parameterA is the IP of the device
parameterB is the username with ability to shutdown the system
parameterC is the password of parameterB user
Then there will eventually be a parameterD for the type of system or shutdown method if I can add values to the wake_on_lan without it complaining it’s not valid.