Outputs

Get all device outputs

Returns all available outputs and their (logical) state. See SupportedDevices to learn more about what outputs are available.

URL parameters

  • hostIp: ip address of the API host.

  • deviceId: id of the device.

GET https://{hostIp}:7081/hal/devices/{deviceId}/outputs

Example request:

GET /hal/devices/io1/outputs HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJS...

Example response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
      "value": 0,
      "name": "OUTD1"
  },

  ...

  {
      "value": 1,
      "name": "OUTDX"
  }
]
Status Codes:
Response Headers:
  • Content-Type – defines the serialization format for the response body (this depends on the Accept header of the request)

Response JSON Object:
  • outputs (array) – array with outputs and their logical values (0 or 1)

Get one or more outputs

Returns all desired outputs and their (logical) state.

URL parameters

  • hostIp: ip address of the API host.

  • deviceId: id of the device.

  • outputName1 / outputName2: See SupportedDevices to learn more about what outputs are available.

GET https://{hostIp}:7081/hal/devices/{deviceId}/outputs?outputName={outputName1}&outputName={outputName2}

Example request:

GET /hal/devices/io1/outputs?outputName=OUTD1&outputName=OUTD2 HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJS...

Example response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
      "value": 0,
      "name": "OUTD1"
  },
  {
      "value": 1,
      "name": "OUTD2"
  }
]
Status Codes:
Response Headers:
  • Content-Type – defines the serialization format for the response body (this depends on the Accept header of the request)

Response JSON Object:
  • outputs (array) – array with outputs and their logical values (0 or 1)

Set one or more outputs

Sets outputs to a desired (logical) state.

URL parameters

  • hostIp: ip address of the API host.

  • deviceId: id of the device.

URL body

Array with outputs, each with their desired action and logical value(s). To be able to support all action types on a specific output, the following generic parameters are used for each output:

  • state (integer) : possible values : 1,2,3 or 4

  • 1 : Set / Set Pulse : persistent set to a value or set to a value for a certain time

  • 2 : Reset : persistent set to value 0

  • 3 : Toggle: persistent set to previous value

  • 4 : Interval: repetitively set to either value1 or value2 for a certain time

  • value1 (integer) : 0 or >0 (always 1 for digital output)

  • time1 (integer) : time in ms. Value may be 0 or >100 [100,65635]

  • value2 (integer) : 0 or >0 (always 1 for digital output)

  • time2 (integer) : time in ms. Value may be 0 or >100 [100,65635]

../../../_images/Interval.png

The table below specifies the values for Value1, Time1, Value2, Time2 related to the State property

State

Value1

Time1

Value2

Time2

Result

Reset

x

x

x

x

Persistent set to value 0

Toggle

x

x

x

x

Persistent set to previous value

Set

>0

0

0

0

Set persistently to Value1

Set

>0

1000

0

0

Set to Value1 for 1000ms, then persistent set to value 0 (Set Pulse)

Set

0

0

>0

>0

Not supported

Interval

>0

1000

>0

1000

Set to Value1 for 1 second, then set to Value2 for 1 second and repeat this endlessly.

POST https://{hostIp}:7081/hal/devices/{deviceId}/outputs

Example request:

POST /hal/devices/io1/outputs HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJS...

[
  {
      "name": "OUTD1",
      "state" : 1,
      "value1" : 1,
      "time1" : 0,
      "value2" : 0,
      "time2" : 0
  },

  ...

  {
      "name": "OUTDX",
      "state" : 1,
      "value1" : 1,
      "time1" : 1000,
      "value2" : 0
      "time2" : 0
  }
]

Example response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Status Codes:
Response Headers:
  • Content-Type – defines the serialization format for the response body (this depends on the Accept header of the request)