I’ve written a hass python script to build a curl string, and it provides the right answer which I can see in the logs.
2017-10-05 10:40:34 WARNING (SyncWorker_14) [homeassistant.components.python_script.mote-self-hass-api-call.py] http://192.168.178.30:5000/mote/api/v1.0/larsonloop_rgb/1200/0/255/40/0/0.425/1/3
What I want to do next is take that string, put “curl -s” in front of it, and run it.
Should I try to put it to put that string value into a sensor, and then run it using that?
Or is there a way I could run the curl string from inside the script?
Since you are already inside a python script you should take a look at the requests library. You can then issue the network call with it.
If you absolutely need to use curl you could call it from the python script with an os.system(“curl …”)
I’m not sure you can run curl from inside a script. At the moment you can’t import modules.
As you said you can set the state of a sensor and then create a shell_command which runs “curl -s {{ states.sensor.name_of_the_sensor.state }}”
Thanks!
There’s a way to get python3 scripts to run in Hassio now, that fixes this for me: