Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Siemens TDs and TMs files #133

Merged
merged 9 commits into from Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions events/2021.06.Online/TD/TDs/Siemens/README.md
@@ -0,0 +1,24 @@
# Siemens - June 2021 Online TestFest

We expose the following virtual things (with [node-wot](https://github.com/eclipse/thingweb.node-wot/)):
* [Smart-Coffee-Machine](http://plugfest.thingweb.io:8083/smart-coffee-machine)
* [TestThing](http://plugfest.thingweb.io:8083/testthing)
* [Multilanguage Counter](http://plugfest.thingweb.io:8083/counter)
* [Smart Charging with Web of Things](https://github.com/sebastiankb/wot-smart-charging)

## WebUIs

Moreover, there are several Web UIs available:
* [Generic WebUI](http://plugfest.thingweb.io/webui/)
* [Smart Coffee Machine - Property Live Monitor](http://plugfest.thingweb.io/examples/smart-coffee-machine.html)
* [Counter UI](http://plugfest.thingweb.io/examples/counter.html)
* [WoT-FXUI](http://plugfest.thingweb.io:8088/test/fullscreen/default)


## Geolocation of WoT Things

See [map demo](https://danielpeintner.github.io/wot-pages/2021.03.Online/geolocation-ui.html).
Mockup code geolocation-ui.html

TODOs:
* autopopulate map with markers from Plugfest TDs (see `L.marker()` calls in geolocation-ui.html)
1 change: 1 addition & 0 deletions events/2021.06.Online/TD/TDs/Siemens/counter.td.jsonld
@@ -0,0 +1 @@
{"title":"counter","titles":{"en":"counter","de":"zähler","it":"Contatore"},"description":"counter example Thing","descriptions":{"en":"counter example Thing","de":"Zähler Beispiel Ding","it":"Contatore Esempio"},"support":"git://github.com/eclipse/thingweb.node-wot.git","@context":["https://www.w3.org/2019/wot/td/v1",{"iot":"http://example.org/iot"},{"@language":"en"}],"properties":{"count":{"type":"integer","description":"current counter value","descriptions":{"en":"current counter value","de":"Derzeitiger Zähler Stand","it":"valore attuale del contatore"},"iot:Custom":"example annotation","observable":true,"readOnly":true,"writeOnly":false,"forms":[{"href":"http://plugfest.thingweb.io:8083/counter/properties/count","contentType":"application/json","op":["readproperty"],"htv:methodName":"GET"},{"href":"http://plugfest.thingweb.io:8083/counter/properties/count/observable","contentType":"application/json","op":["observeproperty","unobserveproperty"],"subprotocol":"longpoll"},{"href":"coap://plugfest.thingweb.io:5683/counter/properties/count","contentType":"application/json","op":["readproperty","observeproperty","unobserveproperty"]}]},"countAsImage":{"description":"current counter value as SVG image","forms":[{"href":"http://plugfest.thingweb.io:8083/counter/properties/countAsImage{?fill}","contentType":"image/svg+xml","op":["readproperty"],"htv:methodName":"GET"},{"href":"coap://plugfest.thingweb.io:5683/counter/properties/countAsImage","contentType":"image/svg+xml","op":["readproperty"]}],"observable":false,"readOnly":true,"uriVariables":{"fill":{"type":"string"}},"writeOnly":false},"redDotImage":{"description":"Red dot image as PNG","forms":[{"href":"http://plugfest.thingweb.io:8083/counter/properties/redDotImage","contentType":"image/png","op":["readproperty"],"htv:methodName":"GET"},{"href":"coap://plugfest.thingweb.io:5683/counter/properties/redDotImage","contentType":"image/png","op":["readproperty"]}],"observable":false,"readOnly":true,"writeOnly":false},"lastChange":{"type":"string","description":"last change of counter value","descriptions":{"en":"last change of counter value","de":"Letzte Änderung","it":"ultima modifica del valore"},"observable":true,"readOnly":true,"writeOnly":false,"forms":[{"href":"http://plugfest.thingweb.io:8083/counter/properties/lastChange","contentType":"application/json","op":["readproperty"],"htv:methodName":"GET"},{"href":"http://plugfest.thingweb.io:8083/counter/properties/lastChange/observable","contentType":"application/json","op":["observeproperty","unobserveproperty"],"subprotocol":"longpoll"},{"href":"coap://plugfest.thingweb.io:5683/counter/properties/lastChange","contentType":"application/json","op":["readproperty","observeproperty","unobserveproperty"]}]}},"actions":{"increment":{"description":"Incrementing counter value (with optional step parameter as uriVariable)","descriptions":{"en":"increment value","de":"Zähler erhöhen","it":"incrementare valore"},"uriVariables":{"step":{"type":"integer","minimum":1,"maximum":250}},"forms":[{"href":"http://plugfest.thingweb.io:8083/counter/actions/increment{?step}","contentType":"application/json","op":["invokeaction"],"htv:methodName":"POST"},{"href":"coap://plugfest.thingweb.io:5683/counter/actions/increment","contentType":"application/json","op":"invokeaction"}],"idempotent":false,"safe":false},"decrement":{"description":"Decrementing counter value (with optional step parameter as uriVariable)","descriptions":{"en":"decrement value","de":"Zähler verringern","it":"decrementare valore"},"uriVariables":{"step":{"type":"integer","minimum":1,"maximum":250}},"forms":[{"href":"http://plugfest.thingweb.io:8083/counter/actions/decrement{?step}","contentType":"application/json","op":["invokeaction"],"htv:methodName":"POST"},{"href":"coap://plugfest.thingweb.io:5683/counter/actions/decrement","contentType":"application/json","op":"invokeaction"}],"idempotent":false,"safe":false},"reset":{"description":"Resetting counter value","descriptions":{"en":"Resetting counter value","de":"Zähler resettieren","it":"resettare valore"},"forms":[{"href":"http://plugfest.thingweb.io:8083/counter/actions/reset","contentType":"application/json","op":["invokeaction"],"htv:methodName":"POST"},{"href":"coap://plugfest.thingweb.io:5683/counter/actions/reset","contentType":"application/json","op":"invokeaction"}],"idempotent":false,"safe":false}},"events":{"change":{"description":"change event","descriptions":{"en":"change event","de":"Änderungsnachricht","it":"resettare valore"},"forms":[{"href":"http://plugfest.thingweb.io:8083/counter/events/change","contentType":"application/json","subprotocol":"longpoll","op":["subscribeevent","unsubscribeevent"]},{"href":"ws://plugfest.thingweb.io:8083/counter/events/change","contentType":"application/json","op":"subscribeevent"},{"href":"coap://plugfest.thingweb.io:5683/counter/events/change","contentType":"application/json","op":["subscribeevent","unsubscribeevent"]}]}},"@type":"Thing","security":["nosec_sc"],"id":"urn:uuid:fc6dafae-b2df-4fa1-ac43-b6466d03bc38","forms":[{"href":"http://plugfest.thingweb.io:8083/counter/all/properties","contentType":"application/json","op":["readallproperties","readmultipleproperties"]}],"securityDefinitions":{"nosec_sc":{"scheme":"nosec"}}}
67 changes: 67 additions & 0 deletions events/2021.06.Online/TD/TDs/Siemens/ecar.td.jsonld
@@ -0,0 +1,67 @@
{
"@context": "https://www.w3.org/2019/wot/td/v1",
"@type": "Thing",
"security": ["nosec_sc"],
"securityDefinitions": {
"nosec_sc": {"scheme": "nosec"}
},
"title": "eCar",
"description": "eCarThing",
"base": "http://127.0.0.1:8080",
"properties": {
"soc": {
"type": "number",
"description": "Current chargingStatus in % (0 ... 100%)",
"readOnly": true,
"minimum": 0,
"maximum": 100,
"unit": "%",
"forms": [
{
"href": "/ecar/properties/soc",
"contentType": "application/json",
"op": ["readproperty"]
}
]
},
"status": {
"type": "string",
"description": "Current car status (readyToCharge, charging, stopCharging)",
"readOnly": true,
"enum": [
"readyToCharge",
"charging",
"stopCharging"
],
"forms": [
{
"href": "/ecar/properties/status",
"contentType": "application/json",
"op": ["readproperty"]
}
]
}
},
"actions": {
"startCharging": {
"description": "Starting to charge",
"forms": [
{
"href": "/ecar/actions/startCharging",
"contentType": "application/json",
"op": ["invokeaction"]
}
]
},
"stopCharging": {
"description": "Stopping to charge",
"forms": [
{
"href": "/ecar/actions/stopCharging",
"contentType": "application/json",
"op": ["invokeaction"]
}
]
}
}
}
137 changes: 137 additions & 0 deletions events/2021.06.Online/TD/TDs/Siemens/geolocation-ui.html
@@ -0,0 +1,137 @@
<!DOCTYPE html>
<html>
<head>
<title>Geolocation of WoT Things</title>

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>

<!--<script src="https://cdn.jsdelivr.net/npm/@node-wot/browser-bundle@latest/dist/wot-bundle.min.js"></script>-->
<script src="https://cdn.jsdelivr.net/npm/@node-wot/browser-bundle@0.7.1/dist/wot-bundle.min.js"></script>
</head>
<body>
<h1>Geolocation of WoT Things<sub><code>(events/2021.06.Online)</code></sub></h1>
<p><mark>TODO autopopulate map with markers from Plugfest TDs</mark></p>

<!--
# What do we want to show on the map ?
* of course the location
* Where to find the ThingDescription
* is not part of the TD
* what is the best way to indicate it
* Is there a user interface one can use
* e.g., http://plugfest.thingweb.io/examples/smart-coffee-machine.html or http://plugfest.thingweb.io/examples/counter.html
* again not part of a TD
* What else ?
* current property values (difficult when it comes to protected things)?
* ...
-->

<div id="mapid" style="width: 98%; height: 600px;"></div>
<script>
// IDEA *how* tp populate a map with things
// 1. Collect list of TDs
// 2. Interpret location (different vocabularies)
// 3. Show marker on map with reference to additional information like UIs, TDs, ...

/*
var servient = new Wot.Core.Servient();
servient.addClientFactory(new Wot.Http.HttpClientFactory());
servient.addClientFactory(new Wot.Http.HttpsClientFactory());
var helpers = new Wot.Core.Helpers(servient);
// https://raw.githubusercontent.com/w3c/wot-testing/master/events/2020.09.Online/TDs/Hitachi/hitachi-led.jsonld
helpers.fetch("https://raw.githubusercontent.com/w3c/wot-testing/master/events/2020.09.Online/TDs/Siemens/counter.jsonld").then((td) => {
alert(td.title + " loaded");

// walk over file and load longitude and latitude
}).catch((error) => {
window.alert("Could not fetch TD.\n" + error)
})
*/

// var mymap = L.map('mapid').setView([51.505, -0.09], 13);
var mymap = L.map('mapid').setView([51.505, -0.09], 2);

L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
id: 'mapbox/streets-v11',
tileSize: 512 ,
zoomOffset: -1
}).addTo(mymap);

// L.marker([51.5, -0.09]).addTo(mymap)
// .bindPopup("<b>Hello world!</b><br />I am a popup.");
// .openPopup();

// Siemens
L.marker([48.089919, 11.649187]).addTo(mymap)
.bindPopup("<b>Siemens</b><br /><a target='_blank' href='http://plugfest.thingweb.io/examples/smart-coffee-machine.html'>Smart Coffee Machine</a> <br /><a target='_blank' href='http://plugfest.thingweb.io/examples/counter.html'>Multilanguage Counter</a>");

// Intel
// events/2020.09.Online/TDs/Intel/intel-ocf/Intel-OCF-button1touch.jsonld
// "s:longitude": "47.3816744",
// "s:latitude": "-68.3193975",
L.marker([47.3816744, -68.3193975]).addTo(mymap)
.bindPopup("<b>Intel</b>");


// Hitachi
// events/2020.09.Online/TDs/Hitachi/hitachi-led.jsonld
// "s:longitude": "35.70352",
// "s:latitude": "139.4720174",
L.marker([35.70352, 139.4720174]).addTo(mymap)
.bindPopup("<b>Hitachi</b>");

// UNIBO
// https://github.com/w3c/wot-testing/tree/master/events/2020.09.Online/TDs/UNIBO
// "geo":{
// "latitude":"44.513348",
// "longitude":"11.3193218"
// }
L.marker([44.513348, 11.3193218]).addTo(mymap)
.bindPopup("<b>UNIBO</b>");
// events/2020.09.Online/TDs/UNIBO/farmTDs/SoilSensor0.td.jsonld
// "position": {
// "x": 11.703963279724121,
// "y": -19.781078338623047,
// "z": 9.677474021911621
// },
L.marker([11.703963279724121, -19.781078338623047]).addTo(mymap)
.bindPopup("<b>UNIBO SoilSensor0</b>");

/* L.circle([51.508, -0.11], 500, {
color: 'red',
fillColor: '#f03',
fillOpacity: 0.5
}).addTo(mymap).bindPopup("I am a circle."); */

/* L.polygon([
[51.509, -0.08],
[51.503, -0.06],
[51.51, -0.047]
]).addTo(mymap).bindPopup("I am a polygon."); */


var popup = L.popup();

function onMapClick(e) {
popup
.setLatLng(e.latlng)
.setContent("You clicked the map at " + e.latlng.toString())
.openOn(mymap);
}

mymap.on('click', onMapClick);

</script>



</body>
</html>
59 changes: 59 additions & 0 deletions events/2021.06.Online/TD/TDs/Siemens/pv-system.td.jsonld
@@ -0,0 +1,59 @@
{
"title": "PV-System",
"id": "urn:dev:wot:example:pv-system",
"description": "Solar power system",
"events": {
"status": {
"title": "Operating status",
"description": "Possible operating status (powerOn, powerOff, error)",
"data": {
"type": "string",
"enum": [
"powerOn",
"powerOff",
"error"
]
},
"forms": [
{
"href": "mqtt://broker.hivemq.com:1883/PV-System/events/status",
"contentType": "application/json",
"op": [
"subscribeevent",
"unsubscribeevent"
]
}
]
},
"power": {
"title": "Current power",
"description": "Power in Watt",
"data": {
"type": "number",
"minimum": 0,
"maximum": 7500,
"unit": "W"
},
"forms": [
{
"href": "mqtt://broker.hivemq.com:1883/PV-System/events/power",
"contentType": "application/json",
"op": [
"subscribeevent",
"unsubscribeevent"
]
}
]
}
},
"@context": "https://www.w3.org/2019/wot/td/v1",
"@type": "Thing",
"security": [
"nosec_sc"
],
"securityDefinitions": {
"nosec_sc": {
"scheme": "nosec"
}
}
}