Please help me.
My service provider requires POST queries in json format.
Like this: {"action":"getDevices","login":"mylogin","key":"myapikey"}
I wrote the following sensor:
It works perfectly, but I don’t want to use fixed values for “mylogin” and “myapikey”. Instead of these I want to use template values, for example {{ states.input_text.my_login.state) }} etc.
I have tried several options for embedding template value into payload string, but all attempts resulted in an error. For example: payload: '{"action":"getDevices","login":{{states.input_text.my_login.state}},"key":"myapikey"}' (without quotes) payload: '{"action":"getDevices","login":"{{states.input_text.my_login.state}}","key":"myapikey"}' (with quotes) payload: '{"action":"getDevices","login":states.input_text.my_login.state,"key":"myapikey"}' (without braces) payload: '{"action":"getDevices","login":' + {{states.input_text.my_login.state}} + ',"key":"myapikey"}' (concatenate with “+” sign)
…and many more options, but no result.
Similar issue here: I simply don’t find a way to get the resource_template working.
Also customizing the input to be hidden seems to have no effect (homeassistant os)
I just came across this trying to do the same thing, and your solution seems to work fine. I only added the input_text and didn’t try to hide the password in the ui (although i may). But adding the input text into the resource template worked fine. Maybe there’s been an update that added the functionality since you posted this, so just wanted to share in case anyone else is looking for this.
Please tell me how can I use template in payload with multiscrape integration?
For example, my payload (as constant string): {"action":"getDeviceInfo","deviceId":"12345","login":"mylogin","key":"myapikey"}
But I want to use deviceId as template instead of “12345”. For example, as {{states(‘sensor.device_id’)}}
Logger: homeassistant.config
Source: config.py:835
First occurred: 12:19:45 (1 occurrences)
Last logged: 12:19:45
Invalid config for [multiscrape]: [payload_template] is an invalid option for [multiscrape]. Check: multiscrape->multiscrape->0->payload_template. (See ?, line ?). Please check the docs at https://github.com/danieldotnl/ha-multiscrape
Hmm, seems as if this has been removed from the component. I am not using HACS for this integration, so there is an older version running in my system.
I saw your open issue, let’s hope you get an answer soon!