Sensors

SynLink PDUs support a variety of sensors. The most common being a temperature and humidity sensor.


Endpoints

GET    /api/sensors                 Return list of all connected sensors
POST   /api/sensors/:sensor_id      Modifies individual sensor


Sensor Object

{
  "sensorPort": "B",
  "sensorName": "Temperature & Humidity Sensor",
  "sensorType": "temp_hum",
  "sensorId": "2" // temperature sensor ID's will correlate with their port. Smart IO Hubs will be unique per hub.
}
KeyTypeDescription
sensorPortstring"A" or "B" are the available options. Correspond with physical RJ45 ports.
sensorTypestringSpecifies which type of sensor. Example: "temp_hum"
sensorNamestringName for sensor. Not changeable.
sensorIdstringUnique identifier for sensor within a SynLink control module. Temperature/humidity sensors will be tied to the sensor port. Smart IO Hubs will be unique per hub.

Sensor Object - SPA-0010 Temperature & Humidity Attributes

If sensorType is "temp_hum" then the sensor object will have the following attributes.

{
  "sensorTempInC": 22.90574836730957,
  "sensorTempInF": 73.2303466796875,
  "sensorHumidity": 39.50677490234375,
}
KeyTypeDescription
sensorTempInFnumberTemperature in fahrenheit
sensorTempInCnumberTemperature in celsius
sensorHumiditynumberHumidity as a relative percentage

Sensor Object - SPA-0140 Smart IO Hub Attributes

If sensorType is "dio_hub" then the sensor object will have the following attributes.

{
  "outputRelays": [
    {
      "outputRelayName": "Output Relay 1",
      "outputRelayDescription": "Output Relay 1",
      "rebootStatus": "none",
      "state": "OPEN",
      "index": 1
    }...
  ],
  "digitalInputs": [
    {
      "digitalInputName": "Digital Input 1",
      "digitalInputDescription": "Digital Input 1",
      "state": "HI",
      "index": 1
    }...
  ],
  "vdcOutputState": true,
  "userSwitchState": false
}
KeyTypeDescription
outputRelaysarrayArray of output relay objects. See Output Relay Object
digitalInputsarrayArray of digital input objects. See Digital Input Object
vdcOutputStatebooleantrue is ENABLED, false is DISABLED. Changeable.
userSwitchStatebooleantrue is ON, false is OFF. Read Only.

Output Relay Object

KeyTypeDescription
outputRelayNamestringUnique ID for sensor within a SynLink PDU. Changeable.
outputRelayDescriptionstringUser editable description for Output Relay. Max 250 characters. Changeable.
statestring"OPEN", "CLOSE". Changeable.
indexnumber1 through 6. Matches label on Smart IO Hub. Read Only.

Digital Input Object

KeyTypeDescription
digitalInputNamestringUnique ID for sensor within a SynLink PDU
digitalInputDescriptionstringUser editable description for Digital Input. Max 250 characters
statestring"HI", "LOW"
rebootStatusstring"pendingHI", "pendingLOW", "none"
indexnumber1 through 6. Matches label on Smart IO Hub

 

List All Sensors

Returns list of all connected sensors.

GET /api/sensors    Returns all sensors

Example Request

curl 'http://192.168.1.100/api/sensors' \
  --header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k'

Response

Expected response is an array of Sensor Object(s).

[
  {
    "sensorId": "1",
    "sensorPort": "A",
    "sensorName": "Temperature & Humidity Sensor",
    "sensorDescription": "Temperature & Humidity Sensor",
    "sensorTempInC": 22.90574836730957,
    "sensorTempInF": 73.2303466796875,
    "sensorHumidity": 39.50677490234375,
    "sensorType": "temp_hum"
  },
  {
    "sensorId": "8279312",
    "sensorPort": "B",
    "sensorName": "Smart IO Hub",
    "sensorDescription": "Smart IO Hub",
    "sensorType": "dio_hub",
    "outputRelays": [
      {
        "outputRelayName": "Output Relay 1",
        "outputRelayDescription": "Output Relay 1",
        "rebootStatus": "none",
        "state": "OPEN",
        "index": 1
      }...
    ],
    "digitalInputs": [
      {
        "digitalInputName": "Digital Input 1",
        "digitalInputDescription": "Digital Input 1",
        "state": "HI",
        "index": 1
      }...
    ],
    "vdcOutputState": true,
    "userSwitchState": false
  }
]

 

Modify Smart IO Hub Sensor Settings or VDC Output State

PUT /api/sensors/:sensorId                Modify Sensor Settings/State

Request

Follows Authentication Scheme

:sensorId may be replaced with :sensorPort if desired. Endpoint only applies to SPA-0140 Smart IO Hub.

{
  "sensorName": "Lab bench #2 sensor hub",
  "sensorDescription": "Under desk on right side.",
  "vdcOutputState": true
}

sensorName
Name string up to 100 characters.

sensorDesription
Description string up to 250 characters.

vdcOutputState
true is ENABLED, false is DISABLED.

Example Request

curl 'http://192.168.1.100/api/sensors/875552' \
--header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k' \
--data '{"sensorName":"Lab bench #2 sensor hub","sensorDescription":"Under desk on right side."}'

Response

Expected response is a Sensor Object.

{
  "sensorId": "8279312",
  "sensorPort": "B",
  "sensorName": "Smart IO Hub",
  "sensorDescription": "Smart IO Hub",
  "sensorType": "dio_hub",
  "outputRelays": [
    {
      "outputRelayName": "Output Relay 1",
      "outputRelayDescription": "Output Relay 1",
      "rebootStatus": "none",
      "state": "OPEN",
      "index": 1
    }...
  ],
  "digitalInputs": [
    {
      "digitalInputName": "Digital Input 1",
      "digitalInputDescription": "Digital Input 1",
      "state": "HI",
      "index": 1
    }...
  ],
  "vdcOutputState": true,
  "userSwitchState": false
}

Modify Smart IO Hub Output Relay Settings/State

PUT /api/sensors/:sensorId/outputRelay/:outputRelayIndex    Modify Sensor Hub Output Relay State

Request

Follows Authentication Scheme

:sensorId may be replaced with :sensorPort if desired. Endpoint only applies to SPA-0140 Smart IO Hub.

{
  "outputRelayName": "Solenoid valve DC-4",
  "outputRelayDescription": "Solenoid valve #2. Green tag.",
  "state": "OPEN"
}

outputRelayName
Name string up to 100 characters.

outputRelayDescription
Description string up to 250 characters.

state
Valid options are "OPEN" or "CLOSE". Case insensitive.

Example Request

curl 'http://192.168.1.100/api/sensors/875552/outputRelay/1' \
--header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k' \
--data '{"outputRelayName":"Solenoid valve DC-4","outputRelayDescription":"Solenoid valve #2. Green tag.","state":"OPEN"}'

Response

Expected response is a Output Relay Object.

Modify Smart IO Hub Digital Input Settings

PUT /api/sensors/:sensorId/digitalInputs/:digitalInputIndex   Modify Sensor Hub Digital Input State

Request

Follows Authentication Scheme

:sensorId may be replaced with :sensorPort if desired. Endpoint only applies to SPA-0140 Smart IO Hub.

{
  "digitalInputName": "Leak Detection Lab Bench #2",
  "digitalInputDescription": "On the ground, near the power strip.",
}

digitalInputName
Name string up to 100 characters.

digitalInputDescription
Description string up to 250 characters.

Example Request

curl 'http://192.168.1.100/api/sensors/875552/digitalInputs/1' \
--header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k' \
--data '{"digitalInputName":"Leak Detection Lab Bench #2","digitalInputDescription":"On the ground, near the power strip."}'

Response

Expected response is a Digital Input Object.