Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into update-input-data
Browse files Browse the repository at this point in the history
  • Loading branch information
mmccool committed Jun 15, 2022
2 parents 0449066 + d6d30a1 commit 4ae5908
Show file tree
Hide file tree
Showing 6 changed files with 838 additions and 5 deletions.
17 changes: 12 additions & 5 deletions events/2022.06.Online/Profiles/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# WoT March 2022 Plugfest/Testfest
# WoT June 2022 Plugfest/Testfest

* Have captured some TDs now that have "profile" members
* But not all are fully compliant or use the features of the existing "Core Profile" spec, or use that URL
* Have extracted template.csv from profile spec
- [ ] Copy "template.csv" to "manual.csv" for now
## HTTP Profile implementations:

### 1. WoTWebThing:

Demonstrator of a WoTWebThing implementation for a Pump, which implements the baseline and Webhook profile.

Thing Description: [../TD/Oracle/TDs/WoTWebThing.td.jsonld]()

Documentation: [../TD/Oracle/TDs/WoTWebThing.md](../TD/Oracle/TDs/WoTWebThing.md)

The WoTWebThing is online.
135 changes: 135 additions & 0 deletions events/2022.06.Online/Profiles/TD/Oracle/TDs/WoTWebThing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@

# WotWebThing

The *WoTWebThing* is a profile compliant implementation of a pump.

It is a simplified model of a pump for liquids that provides several properties, actions and a Webhook event.

It contains several operation status indicators that are exposed via properties.
These properties can be read individually, or all properties can be read at once.

The *WoTWebThing* provides 3 operations:
- power
- diagnose
- resetFilter

The *WoTWebThing* provides a *filterClogged* event affordance, to which a consumer can subscribe/unsubscribe.

An event subscriber registers the endpoint of a HTTP server that receives event notifications upon subscription.

## Authentication

The *WoTWebThing* requires basic authentication in the HTTP authentication header, as illustrated in the curl examples below.

## Properties

The following properties are defined:

```
Cycle_Peak_Operation_Percent_Of_Minute
Cycle_Cases_Pressure_Max
Cycle_Cases_Pressure_Min
Cycle_Return_Pressure_Max
Cycle_Maximum_Inlet_Pressure
```
### Setting a property

```
% curl -X PUT 130.35.140.146:24042/properties/meaning -u "w3cwotprofile:eliforp" -d "{ value : \"41\" }"
```

### reading a single property
```
% curl 130.35.140.146:24042/properties/meaning -u "w3cwotprofile:eliforp"
{"meaning": 42}
```

### reading all properties

```
% curl 130.35.140.146:24042/properties -u "w3cwotprofile:eliforp"
{
"Cycle_Return_Pressure_Min": 1.3913971190868986,
"Cycle_Maximum_Inlet_Pressure": 301.42182499556196,
"meaning": 42,
"Cycle_Peak_Operation_Percent_Of_Minute": 1.5436025961821986,
"Cycle_Cases_Pressure_Max": 3,
"Cycle_Cases_Pressure_Min": 0,
"Cycle_Return_Pressure_Max": 18.77156927455416
}
```

## Actions

The operation *power* is a synchronous operation which returns an immediate status response.

The *diagnose* operation models an asynchronous operation. When invoked it returns an *ActionStatus* response, which can be used for querying the status of the action. The duration of the action is between 30-60s.

### Synchronous actions
```
curl -v 130.35.140.146:24042/actions/power -u "w3cwotprofile:eliforp" -d "{value: true}"
```

The following action *always* returns *forbidden* for testing purposes:
```
curl -v 130.35.140.146:24042/actions/resetFilter -u "w3cwotprofile:eliforp" -d "{value: true}"
-> forbidden
```

### Asynchronous actions

To invoke an asynchronous action:
```
curl -v -X POST 130.35.140.146:24042/actions/diagnose -u "w3cwotprofile:eliforp"
```

Response is an ActionStatus object:
```
{
"timeRequested": "2022-05-31T13:31:26.895516",
"href": "actions/diagnose/b7968ef8-9e7c-4230-bbca-85be13f35efd",
"status": "running"
}
```

Querying the state of an asynchronous action:
```
% curl -X GET 130.35.140.146:24042/actions/diagnose/40578eed-7b88-4fdb-9f72-90314f924d4a -u "w3cwotprofile:eliforp"
{
"timeRequested": "2022-05-30T18:16:45.169514",
"href": "actions/diagnose/40578eed-7b88-4fdb-9f72-90314f924d4a",
"status": "running"
}
```

After the action has ended:

```
% curl -X GET 130.35.140.146:24042/actions/diagnose/40578eed-7b88-4fdb-9f72-90314f924d4a -u "w3cwotprofile:eliforp"
{
"timeEnded": "2022-05-30T18:17:37.297650",
"timeRequested": "2022-05-30T18:16:45.169514",
"href": "actions/diagnose/40578eed-7b88-4fdb-9f72-90314f924d4a",
"status": "completed"
}
```

## Events

### Event subscription:
```
curl -v -X POST 130.35.140.146:24042/events/filterClogged -u "w3cwotprofile:eliforp" -d "{callbackURL : \"http://130.35.140.146:223\" }"
-> {"subscriptionID": 903305380}
```
#### Unsubscribe using callbackURL
```
curl -v -X DELETE 130.35.140.146:24042/events/filterClogged -u "w3cwotprofile:eliforp" -d "{callbackURL : \"http://130.35.140.146:223\" }"
```
#### Unsubscribe using subscriptionId
```
curl -v -X DELETE 130.35.140.146:24042/events/filterClogged -u "w3cwotprofile:eliforp" -d "{"subscriptionID": \"904712663\"}"
```
Loading

0 comments on commit 4ae5908

Please sign in to comment.