#Hibernate windows device over ssh?

1 messages · Page 1 of 1 (latest)

molten parcel
#

Hey, I am trying to hibernate my windows machine via ssh (which is working fine from the phsyical device, generally. But when trying to run the same ssh command as part of a "shell command", nothing happens and I can't really figure out why.

Does anyone have any ideas on how I could accomplish this smoothly? The end result, is to hibernate my desktop before the power to my desk gets shut off if I am at work or if I am going to sleep.

lapis topaz
molten parcel
#

SSH just seemed like the more native choice.

#

But something, not really sure what, keeps waking the device back up now whichw asn't the case before I started messing with HA.

shell_command:
  hibernate_desktop: '/usr/bin/ssh -i /config/ssh/file -o StrictHostKeyChecking=no -o ConnectTimeout=5 me@desktop "shutdown /h /f"'
#

Problem with this, is that ssh will stay connected to the Windows device, and if you click on enter / return, it will wake the device back up

spring prairie
#

Try to run that command via the terminal first in the context of the homeassistant container.

molten parcel
#

I did, it works.

#

I did think about setting up HASS Agent, but, I didn't want to go through the hassle of adding mqtt as well (I know it isn't a huge hassle). but, also I wanted something that wasn't tied to another service.

spring prairie
#

Did you test it inside the homeassistant container?

molten parcel
#

I tried on the physical host, which works.
Inside the docker guest, I receive: ssh: connect to host desktop port 22: Operation timed out

If I try and ping though, I receive responses:

# ping desktop
PING desktop (192.168.50.65): 56 data bytes
64 bytes from 192.168.50.65: seq=0 ttl=128 time=0.337 ms
64 bytes from 192.168.50.65: seq=1 ttl=128 time=0.354 ms
64 bytes from 192.168.50.65: seq=2 ttl=128 time=0.271 ms
^C
--- desktop ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.271/0.320/0.354 ms
#

Or if I use nc I also receive a response:

# nc desktop 22
SSH-2.0-OpenSSH_for_Windows_9.5
spring prairie
#

Try the FQDN.

#

Also try with the ip.

molten parcel
#

I think it is working now, but, needed the authorization yes/no prompt to succeed

#

And I think I found that wake on pattern match was causing it to wake up as opposed to a wake on magic packet switch

#

Also, is hass.agent not being updted anymore? The last release was in 2022?

lapis topaz
molten parcel
lapis topaz
#

could be 😛

#

its one of those thing i installed ages ago and it does what i need it to do so i dont touch it

molten parcel
#

Eh, and now it isn't working agian. :/

#

I'll look at HASS Agent