@RadioTech wrote:
Dear all.
A very beginner question.
I want to be able to use a variable (text_input.some_text) in a payload (using mqtt and iotlink).
Below is a example of something that does not “compile” with the error (I guess the reaon for this is that I’m using a ’ to “expand” the variable and then payload thinks the string is finished?):
bad indentation of a mapping entry at line xx, column xx:
… \Program Files (x86)\Magic RDS", “user”: “”, “visible”: true, " …sequence: - service: mqtt.publish data: topic: "iotlink/workgroup/lydtelelap02/commands/run" payload: '{ "command": "C:\\Program Files (x86)\\Some Directory\\programname.exe", "args": "send:MSG={{ sensor('text_input.some_text')}}", "path": "C:\\Program Files (x86)\\Some Directory", "user": "", "visible": true, "fallback": true }'
If I try to use:
payload: ‘{ “command”: “C:\Program Files (x86)\Some Directory\programname.exe”, “args”: “send:MSG={{ sensor.text_input.some_text.sensor }}”, “path”: “C:\Program Files (x86)\Some Directory”, “user”: “”, “visible”: true, “fallback”: true }’Then I get “send:MSG={{ sensor.text_input.some_text.sensor }}” to the MQTT and not “send:MSG=example” whick I hope to achieve.
Could someone please enlighten me on how I can use a variable in the payload?
Thanks in advance.
Posts: 4
Participants: 3