I’m pretty new to Home Assistant and I’m still just figuring things out. I want to try if one specific automation is possible. The documentation and examples on the site are confusing and I’m not sure what to do where every time. What I would like to happen is when my HUE Motion Sensor is activated (the trigger) the action is that an external URL is called. This can be simple HTTP POST (curl) or any other way. What is the best way to make this happen in an automation?
Thanks for the pointer. I just found the shell_command and have this working succesfully for now as a test. Is there a big advantage to use RESTful instead of shell_command when all I have to do is call a URL, without payload or any variables?
For your purposes, there isn’t much difference. They will both accomplish the same thing, especially if there are no payloads involved. The RESTful command is likely slightly faster to execute since it’s a direct python call, versus the system command is a python call to local system command, which then makes a call to the server you’re reaching out to.
The one thing that I would say makes a difference is what the underlying OS is. If you’re managing the OS, you’re fine. If you’re running Hassio, the underlying container that’s being used to run Home Assistant could be updated to remove the system command you’re using. Is it likely that the Hassio team will remove CURL from future releases? No. But since you’re not managing the OS in this case, you don’t know for sure. In a case like this, you are safer to use the functions within Home Assistant to accomplish tasks.
Ultimately though, this is the power of an open source, roll your own home automation system. There’s a lot of ways to accomplish the same task, and you get to choose the one that works best for you.