Shell_command for remote SSH - no errors in log

I have a remote ESXi server that I’m controlling with a WOL switch. Within the switch config, I’m letting it call a shell_command:

turn_off_esxi: 'ssh -o UserKnownHostsFile=/dev/null -o LogLevel=fatal -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [email protected] "/sbin/ && /sbin/poweroff"'

I’ve tested the command by pasting the above in the hassio terminal addon, and it works as expected, so I believe the the keys/code are setup properly. However, calling the shell_command within the home assistant developer UI does not do anything (seems like ESXi never received it) and also does not log any errors within hassio.

Any ideas?

Thanks for the clear write-up. It’s great but unfortunately doesn’t seem to solve my problem.
I was able to run the command using the add-on while within the home assistant container. It does what its supposed to in the shell, but it does not work when used in shell_command.

So one thing about shell command in particular is that it runs in a more secure environment that prevents some things, as noted in the doc. Looking at your command though nothing obvious is jumping out at me. You have an && in there but its part of the command you’re passing over ssh so I think that should be ok.

Do you have log level set to debug for shell command? It logs stdout and stderr that way so that might give some hints.

Good point. I haven’t. Let me try turning on debug log for the shell command.