How to run commands from Home Assistant
Russ last edited by
Here's how you trigger commands on your computers from Home Assistant using a RESTful Command.
Add this to the end of your configuration.yaml file:
rest_command: triggercmd_calculator: url: 'https://www.triggercmd.com/api/run/triggerSave' method: "post" content_type: "application/x-www-form-urlencoded" payload: "trigger=calculator&computer=russfam&token=(your token from Instructions page)"
You can test it by clicking the little cell phone icon in the lower left under Developer tools, then select rest_command.triggercmd_calculator in the Service field, then click CALL SERVICE. This is what it should look like:
I installed Home Assistant on my QNAP nas as a Docker container. If you do that, I recommend these two settings:
- Create a folder you have access to, and mount it as /config in your container. That will give you easy access to the configuration files, and when you upgrade the container, you can re-mount this folder to /config.
- Use HOST networking, so you can access Home Assistant at a URL like http://nas:8123.
rafastanger last edited by
I can get the commands to be executed by Alexa, but when I try to make the call directly through the Home Assistant, I get the error: Status Code 400
Does the call syntax remain the same?
Russ last edited by Russ
@rafastanger, that should still work, but you can also use this "get" method below. One thing to note - your trigger and computer values can be different from your voice words you'd use with Alexa.
rest_command: triggercmd_calculator: url: 'https://www.triggercmd.com/api/run/triggerSave?trigger=calculator&computer=russhp&token=(your token)' method: "get"
blizzrdof77 last edited by
Is it possible to pass arguments via this method?
Russ last edited by
@blizzrdof77, good question. Yes, you can add this to your URL or payload to pass parameters:
You can use a space or %20 between parameters if you have multiple parameters to pass, like this: