# DEC4IoT Sensor Interface ## Onboarding UI SemCon **Image:** - [x] `oydeu/dc-iot`: https://hub.docker.com/r/oydeu/dc-iot **Funktionen:** User Interface: - [x] Liste registrierter Sensoren https://dec4iot.data-container.net/sensors - [x] Sensorinformationen anzeigen https://dec4iot.data-container.net/sensors/1 - [x] Attribute: identifier & addInfo - [x] QR Code für Onboarding - [x] neuen Sensor hinzufügen https://dec4iot.data-container.net/sensors/new - [x] Sensor bearbeiten https://dec4iot.data-container.net/sensors/1/edit - [x] Sensor löschen API Endpunkte: - [x] `POST /api/data` Beispiel: ```bash= echo '{"data":{"content":{"hello": "DEC112"}}}' | \ curl -H "Content-Type: application/json" -d @- \ -X POST https://dec4iot.data-container.net/api/data ``` - [x] `GET /api/data?query` Beispiel: ```bash= curl "https://dec4iot.data-container.net/api/data?dri=zQmYo6dLpCeCFLzsQKDxnMK9k6aDe4wvLw1gcCVyct36w1P" ``` ### Sensor Attribute: - [x] identifier: String * default: id von DB * max 4 Zeichen - [x] serviceEndpoint: String * max: 15 Zeichen - addInfo: YAML zu Sensorinformationen ```yaml= - name: John Doe - email: - john@doe.com - sensor: Puck.js | Bungle.js - address: - city: Vienna - street: 100 Main Street - floor: 2 - room: 205 ``` **Onboarding QR Code:** Format: ```json= { "sensor-id":"1", "serviceEndpoint":"dec112.eu/iot" } ``` - [x] Gabriel: konfiguriere dec112.eu/iot zeigt auf https://dec4iot.data-container.net/api/data Image: (from: https://tools.learningcontainer.com/qr-code-generator/) ![](https://i.imgur.com/OnEp7Tx.png) ## Format von Sensoren * SenML - [ ] add GPS data at EPS32 in senML object ```json= [ { "n": "batt", "u": "%EL", "v": 56, "bn": "urn:dev:mac:cce0e7ffff204385:", "bt": 1680522712 }, { "n": "id", "vs": "1" # identifier (4 chars max) }, { "u": "lat", "v": 60.07965 } { "u": "lon", "v": 40.123 } { "n": "temp", "u": "Cel", "v": 20 }, { "n": "move", "vb": false }, { "n": "button", "vb": false } ] ``` - [ ] Gabriel: add location via DHCP at ESP32? ## Monitoring - [x] Email bei niedriger Batterie add location information from senML location - [ ] Feueralarm bei Temp > 50 - [ ] Rettungsalarm bei Button True ## Schnittstelle zu NG112 HTTP-Interface: HTTP POST https://app.test.dec112.eu:8081/api/v1/update/dec4iot-test Mutual-TLS beachten! ### Beispiel ```bash= curl --cert fullchain.pem --key privkey.pem -X POST https://app.test.dec112.eu:8081/api/v1/update/dec4iot-test ``` ### Payload ```json= { /* default = sos (general) */ "target": "ambulance|police|fire", /* configuration Monitoring */ "callId": "---DRI-von-Event---" /* event logik */ "sensorId": "ESP32-123456", /* aus Zeitreihendaten "n" (name) */ "language": "de-at", /* additionalData von Sensor Config */ "category": "safety|security|rescue|fire|health|CBRNE|other", /* configuration Monitoring */ "event": "Großbrand in ABC", /* additionalData von Sensor Config */ "contact": "Unternehmen XYZ, Tel: 07321234567", /* additionalData von Sensor Config */ "web": "https://xyz.com/webcam?auth=123", /* additionalData von Sensor Config */ "headline": "Feuer in Lagerhalle XYZ", /* additionalData von Sensor Config */ "locations": [{ "longitude": 14, "latitude": 9, "radius": 10, "altitude": 10, "method": "GPS", "timestamp": "2023-08-31T12:14:43.232Z" }, { "method": "Manual", "civic": { /* Street */ "A6": "Steingasse 3", /* House number */ "HNO": "3", /* Floor */ "FLR": "3", /* Postal code */ "PC": "4786", /* City */ "A3": "Brunnenthal" } }] /* aus GPS Zeitreihendaten von sensor der alarmiert */ /* Auswahl: letzten 30min, aber max. 10 Datensätze */ /* + additionalData von Sensor Config */ } ``` Es werden nur Zertifikate akzeptiert, die von Letsencrypt signiert wurden. - [x] Gabriel: wie wird Location Information (in Form von GPS) übergeben? - [x] Gabriel: Area mit PIDF-LO Daten populieren ### Demosetup * Webclient: https://psap.test.dec112.eu/ * Server: `wss://psap.test.dec112.eu:8091/api/v1` * Benutzername: `christophtest` * (IM4DEC user: `im4dec-test-UDyizndJXHe4ytFvaiu4RZEQ`) working example in OYD K8S cluster (in `/home/user/staging/dec4iot/creds`): ``` echo '{"web":"https://www.ownyourdata.eu/de/impressum/","event":"Notruftaste auf IoT Sensor","title":"DEC112 Notruf via SDK","callId":"zQmWV7jYfjPxGvog5Z7k5X9p8kbrKSx5gxo4Dos6Kgie5P1","target":"ambulance","contact":"Demosetup OwnYourData, Tel: 0677 617 53 112","category":"health","headline":"Notruf durch IoT Sensor","language":"de-at","sensorId":"urn:dev:mac:fb518cffff5b9075manually_triggered","locations":[{"type":"Manual","civic":{"city":"Bad Vöslau","floor":"","street":"Michael Scherz-Straße","postalCode":"2540","houseNumber":"14"}}]}' | curl --cert fullchain.pem --key privkey.pem -H "Content-Type: application/json" -d @- -X POST https://app.test.dec112.eu:8081/api/v1/update/dec4iot-test ```