Home assistant rest post (to external resource) troubleshooting

Hi all,

I’m having some trouble getting the following automation to work. It results in an “automation error” when home assistant is restarted. Guessing I have something wrong with the rest syntax.

automation 8:
  - alias: "Light test"
    trigger:
      platform: state
      entity_id: input_select.light_show
      to: "on"
    action:
      - platform: rest
        name: 'Particle Devices'
        resource: https://api.particle.io/v1/devices/1e0026001247343339383037/WARM_STRIP/
        method: POST
        payload: '{"args": "1,100,30"}'
        headers:
          Authorization: 'access_token SECRET'

I need to use an access token, passed like any other argument as well as the parameters args=“1,100,30”. Here is an example of a working cURL:

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'access_token=SECRET&args="1%2C0%2C10"' "https://api.particle.io/v1/devices/1e0026001247343339383037/WARM_STRIP/"

Any help would be greatly appreciated

Best,
Rob

Also tries setting it up as a switch. When switched on I get: ERROR (MainThread) [homeassistant.components.switch.rest] Can’t turn on https://api.particle.io/v1/devices/1e0026001247343339383037/WARM_STRIP/. Is resource/endpoint offline?

switch 2:
  - platform: rest
    name: 'Particle Devices'
    resource: https://api.particle.io/v1/devices/1e0026001247343339383037/WARM_STRIP/
    method: POST
    payload: '{"args": "1,0,10"}'
    headers:
      Authorization: 'access_token SECRET'

Hi Robert,

Did you get the POST operation to work as action?