RPC SetValue not working with a string variable
I followed the knowledge base example to change a boolean variable, and that's working.
This is the template:
https://RPC_username:RPC_password@server_ip_address/API/RPC/SetValue
{"objectName":"Devices\KNX\Light 1","valueName":"Value","value":"true"}
What if the variable is a string type?
{"objectName":"Devices\KNX\Light 1","valueName":"Value","value":"STRINGTEST"}
This command is not working.
Strange that if I try to write a value of "true" or "false" it is accepted!
Obviously the command should be different. But I cannot find anywhere the correct sintax.
Please anyone has succeded in solving this problem?
Thank you.
Hi,
That's happening because in the above example, the variable (which is a true/false value) will only accept True or False text (it's a KNX Light, so it's not expecting other values rather than True or False).
First, you need to start using double slashes when writing the node path, as it's referred on the RPC documentation;
So your actual command should be something like:
{"objectName":"Devices\\KNX\\Light 1","valueName":"Value","value":"STRINGTEST"}Second, make sure that the variable that you'll be using to receive the string, is actually a string variable. It's true that you can send the text True or False to a boolean variable. But if it's a string, make sure that the variable is actually a string, so it can receive any kind of text.
If you want to send a string to a value, you need to wrap the text in both " and '. Example (remove the spaces) " ' test ' "
I've created a string variable on my bOS, and sent a string from Tasker (Android app) by using the RPC, and it's working.
Hope it helps.
Best regards