curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Sending ASCII commands to a device

From: Kaya Saman via curl-users <>
Date: Sat, 1 Aug 2020 18:36:55 +0100


I have a device which is an ASCII HVAC (air conditioning) Wifi gateway
and I'm trying to use Curl to send commands to it.

I'm not sure if it has a RESTful API or not as very little information
is given. The developer documentation for the protocol says this:

"Communication  between  the Intesis device  and the  client (third 
party  control)is  done  though ASCII messages.These messages  are 
composed  by  a  single  line  with ‘\r’, ‘\n’or ‘\r\n’at  the  end  of 
each  line. Capital and non-capital letters are accepted, making no
distinction between them."

One thing that is clear is that it is not JSON or XML. The protocol
specs can be found here in case any one is interested:

Currently I have figured out how to send messages to the gateway by
using the -T flag though upon reading more around the subject and
finding more applicable suggestions here:

It seems that I am not able to use the -d flag to send commands from the

For example if I create a file called "INFO" with contents "INFO" (no
""), then run: curl -T <file-path> <url>

I am able to get the correct response from the gateway. - curl --http0.9
-T INFO <url>

However, if I try to use: curl -X PUT -d <file-path> <url>

I do not get the correct response. In fact nothing is returned.

Is there a way that I can get Curl to send the command via cli instead
of storing it in a file?

Currently I attempted using: curl -X PUT --http0.9 -d "INFO" <url> ;
which doesn't work at all. I also tried replacing "INFO" with @"INFO" to
read the file which also didn't work.

I'm a little confused on what's going on here....

Additionally probably part of the protocol spec is that upon issuing a
-X GET or -X PUT request, even though the correct data is not given the
gateway will start streaming the indoor temperature values reported by
the gateway in response after a delay of 20 or 30 seconds.

I guess part 2 of the question would be how to stop this behavior? As in
how to make curl abort the connection after the correct value is
returned in the case of the -T example above - currently the classic
CTRL+C works but as I will be integrating the command into a script I
need to figure out how to do this automatically?

Many thanks,


Received on 2020-08-01