Kincony KC868-H32B relay controller http command - Printable Version +- Virtuino Forum (https://virtuino.com/forum) +-- Forum: Virtuino (https://virtuino.com/forum/forumdisplay.php?fid=1) +--- Forum: Virtuino IoT (https://virtuino.com/forum/forumdisplay.php?fid=2) +--- Thread: Kincony KC868-H32B relay controller http command (/showthread.php?tid=987) |
Kincony KC868-H32B relay controller http command - jlc - 07-12-2022 Hi, I Try to use KC868-H32B relay controller with Virtuino IOT by http command. I think using Widget with Script and Tool but I don't know how to do. The extract doc says: 1/ Turn ON/OFF every relay: http://192.168.1.10/sw_ctl.cgi?Relay01=ON&postpwd=admin123 // Relay1 ON http://192.168.1.10/sw_ctl.cgi?Relay01=OFF&postpwd=admin123 // Relay1 OFF http://192.168.1.10/sw_ctl.cgi?Relay30=ON&postpwd=admin123 // Relay30 ON http://192.168.1.10/sw_ctl.cgi?Relay30=OFF&postpwd=admin123 // Relay30 OFF http://192.168.1.10/sw_ctl.cgi?RelayFF=ON&postpwd=admin123 //Relay ALL ON http://192.168.1.10/sw_ctl.cgi?RelayFF=OFF&postpwd=admin123 //Relay ALL OFF if successful will feedback: buttonCallback({"btn1":"OFF","btn2":"OFF","btn3":"ON","btn4":"ON","btn5":"OFF","btn6":"ON","btn7":"ON","btn8":"ON","btn9":"ON","btn10":"ON","btn11":"OFF","btn12":"ON","btn13":"ON","btn14":"ON","btn15":"ON","btn16":"ON","btn17":"ON","btn18":"ON","btn19":"ON","btn20":"ON","btn21":"ON","btn22":"ON","btn23":"ON","btn24":"ON","btn25":"ON","btn26":"ON","btn27":"ON","btn28":"ON","btn29":"ON","btn30":"OFF","btn31":"ON","btn32":"ON","post_pwd":"admin123",}); if failed will feedback: Error parameter or password! 2/ Read input port state http://192.168.1.10/input_ctl.cgi?inputFF=RD&postpwd=admin123 if successful will feedback: inputCallback({"input1":"1","input2":"1","input3":"1","input4":"1","input5":"1","input6":"1"}); 1 means: ON 0 means:OFF if failed will feedback: Error parameter or password! Thanks for your help, RE: Kincony KC868-H32B relay controller http command - iliaslamprou - 07-12-2022 Hi, unlock the project -> click the "PLUS" icon on the bottom -> click the tab "Scripts & Tools" -> click the "PLUS" icon on the bottom -> Select the "Http Request" script Enter the http command http://192.168.1.10/sw_ctl.cgi?Relay01=ON&postpwd=admin123 Click the test button. Check the response Click the tab "Settings" Select a variable to trigger the request Select a variable to store the response I think the response is not a valid json Please upload an image with the response If the response is a valid json it is very easy to get the values using the script "Json to Variable Converter" RE: Kincony KC868-H32B relay controller http command - jlc - 07-13-2022 (07-12-2022, 11:55 PM)iliaslamprou Wrote: Hi, RE: Kincony KC868-H32B relay controller http command - iliaslamprou - 07-13-2022 Hi, the response in not a valid json message. The app doesn't have a way to get values from the responsed text. For this cases the app Virtuino 6 has the widget "Text to variables converter". I am thinking to add a tool for this case. I am sorry you can't use this module for now. RE: Kincony KC868-H32B relay controller http command - jlc - 07-16-2022 (07-13-2022, 11:40 PM)iliaslamprou Wrote: Hi, the response in not a valid json message. Hi Ilias, I can put a python script gateway between the RTU and Virtuino. The script will reformat the answer request into a good json format like, {"btn1":"ON", "btn2":"OFF", "btn3":"OFF", "btn4":"OFF"} In this case, can you explain how to use ? Thanks, RE: Kincony KC868-H32B relay controller http command - iliaslamprou - 07-16-2022 I have created a video tutorial. Please check it Virtuino IoT: How to get variables from a received Json message https://virtuino.com/forum/images_examples/json_to_variables.mov RE: Kincony KC868-H32B relay controller http command - jlc - 07-17-2022 (07-16-2022, 09:50 PM)iliaslamprou Wrote: I have created a video tutorial. Please check it Superbe! Thanks a lot. |