WoT Actions are represented as Method Node which is component of an Object that implements IWoTAssetType (see 6.3.8). The Method and its InputArguments and OutputArguments Properties are mapped to a TD as shown in Table 15.
Table 15 – WoT OPC UA Method Mapping
|
WoT Field |
OPC UA Method Mapping |
|
uav:BrowseName |
BrowseName |
|
Title |
DisplayName |
|
uav:ComponentOf |
ComponentOf Reference Target NodeId |
|
Input.Title |
InputArguments.Description |
|
Input.Properties |
InputArguments.Value |
|
Output.Title |
OutputArguments.Description |
|
Output.Properties |
OutputArguments.Value |
|
Forms.Href |
NodeId |
WoT Action Example (using an HTTP protocol binding):
"actions": {
"setTemperature": {
"title": "Set Temperature",
"description": "Sets the desired temperature",
"input": {
"type": "object",
"title": "SetTemperature",
"properties": {
"target": {
"type": "number",
"minimum": 10,
"maximum": 30,
"unit": "degree Celsius"
}
}
}
"forms": [
{
"href": "https://example.com/things/thermostat/actions/setTemperature",
"contentType": "application/json",
"htv:methodName": "POST"
}
]
}
}
The JSON payload in the HTTP call to invoke the setTemperature action would look like this:
{ "target": 22.5 }
Where target is the desired temperature in Celsius (must be between 10 and 30).