API with custom commands

Ólavur7 years ago

Hello,

I am trying to send a custom command using the API.

The command is: *TS01,WFE;0#
Hex value is: 2a545330312c5746453b3023

This works fine using "Custom command" in the web interface but when I try to POST this using the API I cannot get it to work:

This is what I POST. Can anyone tell me what is wrong here?

{
  "deviceId": 1,
  "type": "WFE;0",
  "attributes": {
                
            }
}
</pre?
This is the error I get:
Command WFE;0 is not supported in protocol ulbotech - RuntimeException (BaseProtocol:66 < ActiveDevice:61 < CommandResource:37 < ...)
Anton Tananaev7 years ago

You should use "custom" as the type, and put your command into the attributes as "data".

Ólavur7 years ago

Thanks. Worked like this:

{
  "deviceId": 1,
  "type": "custom",
  "attributes": {
             "data":   "2a545330312c5746453b3023"
            }
}

Must the data attribute be HEX value? It is not possible to use text?

Anton Tananaev7 years ago

It depends on the protocol. For some it's text, for some it's HEX.