Send Windows PC to sleep - SSH Error 255

I made a wake_on_lan switch to wake and sleep my PC years ago and worked pretty well for a long time, but changed a few hardware in the past few months and now is the time to make it work again.

I followed this guide again and SSH works without password now: Remotely shutting down a Windows 10 PC with SSH

The problem is when I run this command from terminal, it works well, but as soon I turn the switch on the UI with this command I get return code: 255; NoneType: None

ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i “/homeassistant/.ssh/id_rsa” user@IPaddress rundll32.exe powrprof.dll,SetSuspendState 0,1,0

Most fixes I found online was already in the guide (chmod, .ssh is in the config folder, which is now homeassistant, but tried /config too)

Once again, the command works from terminal, but not from UI.

Fixed. No idea what fixed it, but the /homeassistant folder is not working and only /config works (for now)

Please:

  • state you installation method (I know none that has /homeassistant)
  • show the actual definition of your (I guess) shell_command

What terminal? That sentence can mean different things depending of your installation method.

Chris it might be op is referring to the homeassistant folder structure created with the new addon thing

It maps /homeassistant to the container for the addon referring to the core config and /config is mapped to the addon’s addon_config folder.

I know my head hurts too.

Lol. It’ll be difficult to make things more confusing :rofl:

But then, the ssh command with /homeassistant won’t work in HA itself, where it should be /config

Do I get it right (not using HAOS myself, if not obvious :wink: )?

1 Like

I’m still trying to figure it alll out… it’s peripherally part of what bit AD and HAs addons so hard yesterday.

So in essence in an addon (and here I assume terminal/SSH) now gets the config folder mounted as /homeassistant so it can read anything in it. (but of course you have to refer to it as /homeassistant/* and thferes some other magic too. I haven’t unwound yet.)

I think what’s going on is when in context of core /homeassistant is /config so…

if op changes the automation to use /config/* instead of /homeassistant/*?

Edit:added reference link from mike

Okay, I fixed it. I have no idea how, but now it works, but yeah there are changings that made it harder than it was years ago.

  1. With Samba share 12.1 addon there is no homeassistant folder, but
  2. in reality homeassistant folder contains the HA config files and DB on the latest stable HA version
  3. the config folder shown as a link now in Midnight Commander
  4. BUT the “/homeassistant/.ssh/id_rsa” does not work (after I fixed I started to try to break again to find out what could be the problem)
  5. ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i "/config/.ssh/id_rsa" [email protected] rundll32.exe powrprof.dll,SetSuspendState 0,1,0

For the record:
(Home Assistant, former HAOS)

The shell command is there thats what turns off my PC via SSH.

Yep that’s the same issue…