Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Kincony KC868-H32B relay controller http command
#1
Question 
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=O...d=admin123 // Relay1 ON
http://192.168.1.10/sw_ctl.cgi?Relay01=O...d=admin123 // Relay1 OFF
http://192.168.1.10/sw_ctl.cgi?Relay30=O...d=admin123 // Relay30 ON
http://192.168.1.10/sw_ctl.cgi?Relay30=O...d=admin123 // Relay30 OFF
http://192.168.1.10/sw_ctl.cgi?RelayFF=O...d=admin123 //Relay ALL ON
http://192.168.1.10/sw_ctl.cgi?RelayFF=O...d=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?inputF...d=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,
Reply
#2
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=O...d=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"
Reply
#3
(07-12-2022, 11:55 PM)iliaslamprou Wrote: 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=O...d=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"


Attached Files Thumbnail(s)
   
Reply
#4
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.
Reply
#5
(07-13-2022, 11:40 PM)iliaslamprou Wrote: 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.

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,
Reply
#6
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_exampl...iables.mov
Reply
#7
(07-16-2022, 09:50 PM)iliaslamprou Wrote: 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_exampl...iables.mov

Superbe! Thanks a lot.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)