Sensor RPC¶
A request is made using the tenant@email.com/v0/device/{device_id}/rpc/command topic with command schema as shown below. The command payload is using keys from the JSON representation of the EEP. More information about the payload is available in the description of the devices.
json
{
"request_id": 1,
"eep": "A5-20-01",
"payload": {
"summerMode": 0,
"temperature": 0,
"temperatureSetpoint": 0,
...
}
}
| key | type and meaning |
|---|---|
| request_id | integer, unique identifier generated by application and used for tracking requests |
| eep | string, EnOcean Equipment Profile. This may be different from device's reporting EEP |
| payload | object, command payload using keys from JSON representation of EEP |
Request results¶
After making a request the application should examine the tenant@email.com/v0/device/{device_id}/rpc/result topic from EnOcean SmartStudio for result of the request.
```json
{ "request_id": 1, "device_id": {device_id}, "tenant_id": {tenant_id}, "message": "Command successfully queued", "success": true } ```
| key | type and meaning |
|---|---|
| request_id | integer, unique identifier of the RPC request |
| success | boolean, status of request |
| message | string, explanation of request's current state |
If EnOcean SmartStudio can properly transcode the request and put the command in queue, the application will receive below result:
json
{
"request_id": 1,
"device_id": {device_id},
"tenant_id": {tenant_id},
"success": true,
"message": "RPC Command successfully queued"
}
Once data is sent from the queue to the device, the application will receive below result:
json
{
"request_id": 1,
"device_id": {device_id},
"tenant_id": {tenant_id},
"success": true,
"message": "RPC request sent to device"
}
Possible error messages¶
If the device type is not set bidirectional, or if the device is not paired
json
{
"request_id": 1,
"device_id": {device_id},
"tenant_id": {tenant_id},
"success": false,
"message": "Device is not configured for bidirectional communication"
}
No gateway is available for the device or the gateway did not report USB information
json
{
"request_id": 1,
"device_id": {device_id},
"tenant_id": {tenant_id},
"success": false,
"message": "Device is not yet ready for RPC"
}
The gateway websocket connection was closed before the southbound command could be sent to the device
json
{
"request_id": 1,
"device_id": {device_id},
"tenant_id": {tenant_id},
"success": false,
"message": "WebSocket connection was closed"
}
RPC command validation failed
json
{
"request_id": 1,
"device_id": {device_id},
"tenant_id": {tenant_id},
"success": false,
"message": "TypeError -> RPC command validation failed"
}
RPC command contains invalid values
json
{
"request_id": 1,
"device_id": {device_id},
"tenant_id": {tenant_id},
"success": false,
"message": "ValueError -> RPC command contains invalid values"
}
Equivalent to 500 error in HTTP
json
{
"request_id": 1,
"device_id": {device_id},
"tenant_id": {tenant_id},
"success": false,
"message": "Unknown error occurred while sending RPC request to device"
}
json
{
"request_id": 1,
"device_id": {device_id},
"tenant_id": {tenant_id},
"success": false,
"message": "<any exception> -> Unknown exception occurred"
}