0

HTTP commands

Alexandre Jacob - Home heaven 8 jaar geleden in Server Solutions bijgewerkt door Andrey S 7 jaar geleden 9

Dear all,

I'm working on a prject in order to intergrate Iridium server with a house automation box.

All the commands for this box are like this :


http://ip:port/core/api/jeeApi.php?apikey=3mp8DMSfVyrjHEtvrQTb&type=cmd&id=XY


XY is an exclusive command. For example for the heating in the kitchen :

XY = 90 fot the heating

XY = 89 for the OFF status


The feedback is


http://ip:port//core/api/jeeApi.php?apikey=3mp8DMSfVyrjHEtvrQTb&type=cmd&id=76



I want to create some groups and define the two last digits later (in the web interface "value").

Do you think it's possible.

The driver is well created and define in the server. All the commands are working separately.


And how can I create an automatic feedback to receive the value every minutes?

Thanks in advance


Image 18003


Image 18004

Feedback


Image 18005







As variant - you may store XY value in Virtual Tag (set Store In DB), and send data by Virtual Channel (use Script Modifier)

function volume (in_Type, in_Name, in_Value) 
{
    IR.Log("in_Type: " + in_Type + "in_Name: " + in_Name + "in_Value: " +  in_Value);
    IR.GetDevice("AV & Custom Systems (HTTP)")
    .Send(['GET,http://ip:port//core/api/jeeApi.php?apikey=3mp8DMSfVyrjHEtvrQTb&type=cmd&id='+
    IR.GetVariable("Server.Tags.store_XY1")]);
}

Use of GetCommandAtName(name/ID).data did not bring results.


You must send command every minute to get feedback, or set this action on house automation box.

http://dev.iridiummobile.net/Editor_Server_Tools/en#Periodic_actions

Thank you very much for your help Andrey... It's difficult without your help :-)

So first I have to create a command and a feedback in the driver.

command : XY_command, type GET but what do I have to put in the URI bow as this URI last digit will be different?






Really sorry Andrey, I'm a beginner with the server :-/ I realised that I was using driver channels in place of Virtual channels like you said... Now it's almost working... I just replaced the IR.GetVariable("Server.Tags.store_XY1") by in_Value to make tests :


IR.GetDevice('Jeedom').Send(['GET,http://myip:port/core/api/jeeApi.php?apikey=3mp9MDSfVyrjHEtvrQTb&type=cmd&id='+in_Value+"\r\n"])


When I insert the value 90, it's in the log and the http command is send to the driver but it doesn't react... Am I wrong somewhere ?





Below the logs, the first command was send from the virtual channel and the second from the driver channel (it's the same command in the box finally)

the first didn't work, the second is ok... what do you think ? I saw a difference : charset iso-8859-1 and UTF-8







You are right - in the command Send we must using a part of url /core/api/jeeApi.php?api..

Try using Wireshark (on PC, where iRidium Server running or on where house automation box) to see what data is being sent (not for protected traffic, use http instead https). As a filter for example:

ip.dst == 192.168.0.1 && tcp.port==80

On the required package, right-click and select Follow->TCP Stream

Thank you so much Andrey, it's working very well... by using in_value. I'll link the number XY to each button in my project.

For the feeback, it's different.... I'm working on it and I come back ;-) Have a great day.

Best regards

Very nice Andrey, the good topic because I'm working on it with receive_data and I was lost.

Thanks