Sensors
A sensor is single measuring point. One physical device can provide multiple measuring points.
Fetching sensors
You can easily fetch all sensors on selected gateway. Returned data will contain:
- basic information about sensor (id, name, etc.)
- last sent value and timestamp
Endpoint
GET /easy/v1/gateways/GATEWAY_ID
Example requests
export ACCESS_TOKEN="ACCESS_TOKEN"
export GATEWAY_ID="DEMO"
curl --header "Authorization: Bearer $ACCESS_TOKEN" \
"https://api.rayleighconnect.net/easy/v1/gateways/$GATEWAY_ID.json"
const api = new rayleighconnect.EasyAPI('ACCESS_TOKEN');
// API call returns a Promise object:
api.fetchSensors(
'DEMO' // gateway_id
).then(console.log).catch(console.error);
from rayleighconnect import EasyAPI
ACCESS_TOKEN = 'ACCESS_TOKEN'
api = EasyAPI(ACCESS_TOKEN)
# API calls return list or None on error.
data = api.fetch_sensors(gateway_id='DEMO')
Example responses
[
{
"id": "e1.kwh",
"name": "Main Incomer kWh",
"timestamp": "2020-01-02T15:22Z", // ISO 8601 compliant UTC
"value": 1544.12,
"unit": "kWh", // (optional)
"interval": 60 // (optional)
}
]
id,name,timestamp,value,unit,interval
e1.kwh,"Main Incomer kWh",2020-01-02T15:22Z,1554.12,"kWh",60
HTTP codes
200 OK401 Unauthorized- returned ifAuthorizationheader is not present or not valid404 Not Found- returned if gateway is not found on an account
Sensor ID
Modbus slave devices
Modbus slave devices like energy meters have IDs in format: eX.SID where X is a decimal modbus address and SID is a subsensor, eg.:
kwh- energy consumptionv3p@1- voltage phase 1v3p@2- voltage phase 2v3p@3- voltage phase 3i3p@1- current phase 1i3p@2- current phase 2i3p@3- current phase 3freq- frequencypf- power factor
Available sensors depend on slave device model and configuration.
Built-in I/O
Gateways, depending on model can feature following sensors:
"1"/"2"- digital inputs"17"/"18"- relay outputs"129"/"130"- analogue inputs"158"- GSM signal strength in dBm