Hiya,
I was trying to add a button into my dashboard which should execute a REST API call.
As preparatory I added the following snippet in my configuration.yaml:
rest_command:
shutdown_delta:
url: "http://delta.local/machine/shutdown"
method: post
As per the documentation (RESTful Command - Home Assistant) there should be a new service under Development Tools.
Unfortunately, there is no new service.
Could anyone assist in this matter?
How would the implementation work with a button in the dashboard?
Thanks for any help!
edit:
After changing the URL from hostname to IP, there’s no more error in the system log.
However, the service still doesnt appear in the development tools
What was the error when you had a hostname in the url
? Your syntax looks right, so I would be surprised if this change would make any difference.
As long as the configuration is correct, there should indeed appear a new service.
You would create a script that calls the new rest command service and you can then add this script just like any other entity onto your dashboard where it appears as a “Run” button.
@exxamalte
the error in the log when I used the hostname was:
No route to resource/endpoint:
http://delta.local/machine/shutdown
For some reason, The service now appeared after multiple restarts.
I was able to write a script and implement it as a run button into the dashboard.
script:
shutdown_delta:
sequence:
- alias: "Shutdown Delta"
service: rest_command.shutdown_delta
Thanks a lot!
2 Likes