.. _SystemIntegration_HandlingOutputs: ####### Outputs ####### Get all device outputs ********************** Returns all available outputs and their (logical) state. See :ref:`SupportedDevices ` to learn more about what outputs are available. **URL parameters** * **hostIp**: ip address of the API host. * **deviceId**: id of the device. .. http:get:: https://{hostIp}:7081/hal/devices/{deviceId}/outputs **Example request**: .. sourcecode:: http GET /hal/devices/io1/outputs HTTP/1.1 Accept: application/json Authorization: Bearer eyJhbGciOiJS... **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 [ { "value": 0, "name": "OUTD1" }, ... { "value": 1, "name": "OUTDX" } ] :statuscode 200: OK :statuscode 400: Bad Request. A descriptive error comes along with this error. :statuscode 401: Unauthorized. Something is wrong with the :mailheader:`Authorization` header of the request :statuscode 403: Forbidden. Something is wrong with the claims of the user. :statuscode 500: Internal Server Error :resheader Content-Type: defines the serialization format for the response body (this depends on the :mailheader:`Accept` header of the request) :>json array outputs: 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 :ref:`SupportedDevices ` to learn more about what outputs are available. .. http:get:: https://{hostIp}:7081/hal/devices/{deviceId}/outputs?outputName={outputName1}&outputName={outputName2} **Example request**: .. sourcecode:: http GET /hal/devices/io1/outputs?outputName=OUTD1&outputName=OUTD2 HTTP/1.1 Accept: application/json Authorization: Bearer eyJhbGciOiJS... **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 [ { "value": 0, "name": "OUTD1" }, { "value": 1, "name": "OUTD2" } ] :statuscode 200: OK :statuscode 400: Bad Request. A descriptive error comes along with this error. :statuscode 401: Unauthorized. Something is wrong with the :mailheader:`Authorization` header of the request :statuscode 403: Forbidden. Something is wrong with the claims of the user. :statuscode 500: Internal Server Error :resheader Content-Type: defines the serialization format for the response body (this depends on the :mailheader:`Accept` header of the request) :>json array outputs: 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] .. image:: /content/HALAPI/Contracts/Interval.png :width: 10% The table below specifies the values for Value1, Time1, Value2, Time2 related to the State property .. table:: +-------------+-----------+----------+-----------+----------+-----------------------------------------------------------------------+ | | | | | | | | 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. | +-------------+-----------+----------+-----------+----------+-----------------------------------------------------------------------+ .. http:post:: https://{hostIp}:7081/hal/devices/{deviceId}/outputs **Example request**: .. sourcecode:: http 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**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 :statuscode 200: OK :statuscode 400: Bad Request. A descriptive error comes along with this error. :statuscode 401: Unauthorized. Something is wrong with the :mailheader:`Authorization` header of the request :statuscode 403: Forbidden. Something is wrong with the claims of the user. :statuscode 500: Internal Server Error :resheader Content-Type: defines the serialization format for the response body (this depends on the :mailheader:`Accept` header of the request)