Hi All,
Working with home assistant right now and having a heck of a time passing arguments to a function.
In home assistant I have my switch set up as the following. Which does access the function but fails to pass the argument.
switch 2:
- platform: rest
name: 'Particle Devices'
resource: https://api.particle.io/v1/devices/1e0026001247343339383037/WARM_STRIP/?access_token=SECRET
method: POST
body_on: "{'args':'1,100,10'}"
I have also tried things like:
’{“args”:"%221%2C100%2C10%22"}’
’{“args”:1,100,1}
’{args:“1,100,10”}’
’{“args”:“1,100,10”}’
“args=1,100,10”
I am able to get this to work in cURL, postman, and python (python example below):
import requests
url = "https://api.particle.io/v1/devices/1e0026001247343339383037/WARM_STRIP/"
payload = "access_token=SECRET&args=%221%2C0%2C10%22"
headers = {
'content-type': "application/x-www-form-urlencoded",
'cache-control': "no-cache",
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
Has anyone else tried to post to a particle using Home assistant? How about with JSON format for the arguments?