Curl command to REST sensor?

I’m trying to setup this curl command as a rest sensor:

curl -s "https://auth.tado.com/oauth/token" -d client_id=tado-web-app -d grant_type=password -d scope=home.user -d username="[email protected]" -d password="Password123" -d client_secret=wZa

When I use the curl command it works fine, but I cannot figure out how to correctly pass the parameter values to the rest sensor. I’ve tried many combinations. What’s the correct method?

I just get unauthorised using things like:

- resource: https://auth.tado.com/oauth/token
  method: POST
  payload: '{ "client_id":"tado-web-app","grant_type":"password","scope":"home.user","username","myemailaddress","password","mypassword","client_secret":"mysecret"}'

I’ve temporarily managed to work around this by using a command_line sensor with the curl command as parameter, but would be good to know how to do this properly…

- resource: https://auth.tado.com/oauth/token
  method: POST
  headers:
    content-type: "application/x-www-form-urlencoded"
  payload: 'client_id=tado-web-app&grant_type=password&scope=home.user&...

1 Like

Brilliant - thank you! Such a simple solution! doh.