Powering off a Windows PC / WinRM question

I have googled / searched - and found blogs and posts about using ‘HASS.agent’ - which I’ve installed and doesn’t seem to work or report into my HA.

WIth my Ansible head on - is it not possible to simply pass a WinRM command to execute a ‘shutdown /s /t 0’ or something?

And secondly - but kind of related; how possible is it do do a ‘WOL’ power on a machine, wait for a PC to come online, and exectute a command?

Thanks in advance!!

Hello Gary,

could you describe better the issue with HASS.agent?
I’ve been using it for a year with no problems.
I don’t turn off the PC, but I put it on standby. However I saw that there is the possibility of turning it off.

Hi there, I can’t get the PC to appear in Home Assistant at all - do you know of a guide to follow? Thanks

I followed the official one: Configuration - HASS.Agent
After installing hass.agent you need a MQTT broker on HA side, and then you must expose some hass.agent command like this:


then you should be able to create a switch like this:


- platform: template
  switches:
    pc_accensione:
      value_template: "{{ is_state('binary_sensor.pc_casa', 'on') }}"
      turn_off:
        service: button.press
        target:
          entity_id: button.desktop_1j67bf0_hibernate