PC shutdown with REST API incorrect command sent from Home Assistant

I am using this PC tool which works from other devices: Release remote-shutdown-pc-v1.1.16 · karpach/remote-shutdown-pc (github.com)

With home assistant it sends a command with nothing appended to the URL so I cannot choose to shut down, lock, restart, etc.

Here’s the commands, each of which if placed in a webbrowser works as intended:

rest_command:
  hibernate:
    url:
        http://192.168.1.105:5001/secret/hibernate
  shutdown:
    url:
        http://192.168.1.105:5001/secret/shutdown
  suspend:
    url:
        http://192.168.1.105:5001/secret/suspend
  turn_screen_off:
    url: 
        http://192.168.1.105:5001/secret/turnscreenoff
  lock:
    url:
        http://192.168.1.105:5001/secret/lock

  restart:
    url:
        http://192.168.1.105:5001/secret/restart
  force_shutdown:
    url:
        http://192.168.1.105:5001/secret/forceshutdown

Whenever I run this from Home Assistant I only ever get what is set as my default option in the shutdown utility.

Never the whole command.
tips?

First, nobody can make sense of your code, please format it properly

f6be36681e0da431418ec7781fb6c62712941803

Second: better ask in the authors gitgub.

Excuse the formatting, there’s all these rules that keep popping up about “New user are only allowed 2 links” etc. so I can never put everything in there.

I managed to get it working. I changed my setup multiple times, and I just wound up resetting Home Assistant to get it working, so I’m not sure which “fix” fixed it, here’s how it should work, when I press the first button the screens turn off, which is not captured by the screen recorder. But yoiu can tell when I hit the lock button, it gets locked:

automated

Here is the exact code format I used which is working currently:

rest_command:
  hibernate:
    url:
        http://192.168.1.105:5001/secret/hibernate

  shutdown:
    url:
        http://192.168.1.105:5001/secret/shutdown

  suspend:
    url:
        http://192.168.1.105:5001/secret/suspend

  turn_screen_off:
    url: 
        http://192.168.1.105:5001/secret/turnscreenoff

  lock:
    url:
        http://192.168.1.105:5001/secret/lock

  restart:
    url:
        http://192.168.1.105:5001/secret/restart

  force_shutdown:
    url:
        http://192.168.1.105:5001/secret/forceshutdown
1 Like