IoT Export
Verbindungs Template
Generic Web Export
17 min
einleitung das export modul "generic web export" stellt die verbindung zu einem mqtt broker her und veröffentlicht status nachrichten unter verschiedenen topics diese topics sind von der struktur her ähnlich aufgebaut wie die url struktur des "generic rest server" export moduls die versendeten nachrichten verwenden das generic iot datenmodell docid 1gmhrwxfum029mcblknnu innerhalb eines container objektes, welches informationen zur nachrichten identifikation bereitstellt es können mehrere export instanzen angelegt werden, jedoch immer nur eine instanz pro broker url nachdem die verbindung zu einem broker aufgebaut wurde, werden alle verfügbaren geräte als update übertragen somit ist sichergestellt das der aktuelle gerätestatus übermittelt wurde nachrichten werden grundsätzlich als string übertragen und sind im regelfall als json objekte formatiert konfiguration im bereich iot export der web konfiguration oder der bsc remote können die export verbindung angelegt, sowie die parameter konfiguriert werden es werden tcp/ssl sowie web socket (http/https) verbindungen unterstützt die authentifizierung ist per nutzername und passwort oder client zertifikat möglich die entsprechenden zertifikate oder zugangsdaten können während der konfiguration hinterlegt werden es besteht die möglichkeit die basis topics zum veröffentlichen von nachrichten anzupassen parameter true falsefalse unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type true falsefalse unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type basis daten von nachrichten alle nachrichten, ausgenommen raw nachrichten, werden als json objekte übertragen grundlegende informationen für die zuordnung von nachrichten sind in allen objekten vorhanden basis felder true falsefalse unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type geräte topics das in der konfiguration hinterlegte "thing topic prefix" dient als basis für alle geräte aktualisierungen ein beispiel dafür wäre "acdbda59e9cf/things" die eigentlichen geräte aktualisierungen werden über verschachtelte "sub topics" veröffentlicht sub topics die sub topics werden nur bei einer änderung von werten benachrichtigt so kann bei der "subscription" gezielt entschieden werden, über welche daten man benachrichtigt wird true falsefalse unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type ändern von werten die änderung eines wertes kann über ein extra dafür vorgesehenes "sub topic" angestoßen werden /\<thing id>/\<channel id>/value/set der neue wert wird einfach als nachricht an dieses topic gesendet sobald der wert (real) geändert wurde, werden entsprechende aktualisierungen an die vorher schon beschriebenen "sub topics" gesendet alternativ gibt es auch ein kommando objekt zum ändern von werten, näheres dazu ist im abschnitt zum kommando topic nachzulesen beispiel daten repräsentation eines gerätes acdbda59e9cf/things/b9f09ef8 3c3f 459e 841f 66bdaedff183 { 	"nodeid" "acdbda59e9cf", 	"eventid" "igu16ksjlsu6m80v", 	"timestamp" 1636543467229, 	"thing" { 	 "id" "b9f09ef8 3c3f 459e 841f 66bdaedff183", 	 "name" "fsb14", 	 "channelgroups" \[{ 	 "channelgroupid" "sensor group", 	 "channeldescriptiondata" null, 	 "channels" \[{ 	 "channelid" "jalousie", 	 "channeldescriptiondata" { 	 "channeltypeenum" "shading", 	 "label" { 	 "de de" "jalousie", 	 "en us" "shutters" 	 } 	 }, 	 "value" "29 0", 	 "valuedescriptiondata" { 	 "valuetype" "number double", 	 "unit" "%", 	 "min" 0 0, 	 "max" 100 0, 	 "stepping" 1 0, 	 "decimalpartdigits" 1, 	 "possiblevalues" null 	 }, 	 "writeable" false, 	 "metainfos" { 	 "metainfo >id" "asensor#b9f09ef8 3c3f 459e 841f 66bdaedff183#jalousie", 	 "message >count" "0", 	 "eoap >changeable" "true", 	 "message >enabled" "false", 	 "sensor name" "jalousie", 	 "tsystems >type" "value" 	 } 	 }, { 	 "channelid" "jalousiestate", 	 "channeldescriptiondata" { 	 "channeltypeenum" "shading", 	 "label" { 	 "de de" "jalousie", 	 "en us" "shutters" 	 } 	 }, 	 "value" "unknown", 	 "valuedescriptiondata" { 	 "valuetype" "state", 	 "unit" null, 	 "min" null, 	 "max" null, 	 "stepping" null, 	 "decimalpartdigits" null, 	 "possiblevalues" { 	 "unknown" { 	 "de de" "unbekannt", 	 "en us" "unknown" 	 }, 	 "up" { 	 "de de" "herauf", 	 "en us" "up" 	 }, 	 "down" { 	 "de de" "herunter", 	 "en us" "down" 	 } 	 } 	 }, 	 "writeable" false, 	 "metainfos" { 	 "metainfo >id" "asensor#b9f09ef8 3c3f 459e 841f 66bdaedff183#jalousiestate", 	 "message >count" "0", 	 "eoap >changeable" "false", 	 "message >enabled" "false", 	 "sensor name" "direction", 	 "tsystems >type" "state" 	 } 	 }, { 	 "channelid" "priority", 	 "channeldescriptiondata" { 	 "channeltypeenum" "switch", 	 "label" { 	 "de de" "priorität", 	 "en us" "priority" 	 } 	 }, 	 "value" "off", 	 "valuedescriptiondata" { 	 "valuetype" "state", 	 "unit" null, 	 "min" null, 	 "max" null, 	 "stepping" null, 	 "decimalpartdigits" null, 	 "possiblevalues" { 	 "unknown" { 	 "de de" "unbekannt", 	 "en us" "unknown" 	 }, 	 "on" { 	 "de de" "an", 	 "en us" "on" 	 }, 	 "off" { 	 "de de" "aus", 	 "en us" "off" 	 } 	 } 	 }, 	 "writeable" false, 	 "metainfos" { 	 "metainfo >id" "asensor#b9f09ef8 3c3f 459e 841f 66bdaedff183#priority", 	 "message >count" "0", 	 "eoap >changeable" "true", 	 "message >enabled" "false", 	 "sensor name" "priority", 	 "tsystems >type" "state" 	 } 	 }, { 	 "channelid" "jalousieslat", 	 "channeldescriptiondata" { 	 "channeltypeenum" "shading", 	 "label" { 	 "de de" "jalousie (lamellen)", 	 "en us" "shutters (slats)" 	 } 	 }, 	 "value" "unknown", 	 "valuedescriptiondata" { 	 "valuetype" "state", 	 "unit" null, 	 "min" null, 	 "max" null, 	 "stepping" null, 	 "decimalpartdigits" null, 	 "possiblevalues" { 	 "unknown" { 	 "de de" "unbekannt", 	 "en us" "unknown" 	 }, 	 "up" { 	 "de de" "herauf", 	 "en us" "up" 	 }, 	 "down" { 	 "de de" "herunter", 	 "en us" "down" 	 } 	 } 	 }, 	 "writeable" false, 	 "metainfos" { 	 "metainfo >id" "asensor#b9f09ef8 3c3f 459e 841f 66bdaedff183#jalousieslat", 	 "message >count" "0", 	 "eoap >changeable" "true", 	 "message >enabled" "false", 	 "sensor name" "jalousieslat", 	 "tsystems >type" "state" 	 } 	 }] 	 }], 	 "state" "online", 	 "parametergroups" null, 	 "metainfos" { 	 "alexa >alexa live updates" "false", 	 "monitoring >monitorable" "true", 	 "teachin >group displayname" "test", 	 "bsc >short info" "fsb14", 	 "metainfo >id" "adevice#b9f09ef8 3c3f 459e 841f 66bdaedff183", 	 "teachin >reference id" "enocean eltako fsb14", 	 "eoap >activated" "true", 	 "teachin >transmission id" "default=4291820288", 	 "lastmodified" "1636543466499", 	 "eoap >alarm" "false" 	 } 	} } einzelner kanalwert acdbda59e9cf/things/b9f09ef8 3c3f 459e 841f 66bdaedff183/jalousie/value { "nodeid" "acdbda59e9cf", "eventid" "igu16ksjlsu6m80v", "timestamp" 1636543467229, "value" "29 0" } raw kanalwert acdbda59e9cf/things/b9f09ef8 3c3f 459e 841f 66bdaedff183/jalousie/value/raw 29 0 meta informationen acdbda59e9cf/things/b9f09ef8 3c3f 459e 841f 66bdaedff183/metainfos { "nodeid" "acdbda59e9cf", "eventid" "igu16ksjlsu6m80v", "timestamp" 1636543467229, "metainfos" { "alexa >alexa live updates" "false", "monitoring >monitorable" "true", "teachin >group displayname" "test", "bsc >short info" "fsb14", "metainfo >id" "adevice#b9f09ef8 3c3f 459e 841f 66bdaedff183", "teachin >reference id" "enocean eltako fsb14", "eoap >activated" "true", "teachin >transmission id" "default=4291820288", "lastmodified" "1636543466499", "eoap >alarm" "false" } } kommando topic über das kommando topic, welches in der konfiguration als "command topic" hinterlegt ist, können verschiedene befehle an das gateway gesendet werden ein kommando besteht immer aus dem kommando type sowie einigen parametern die parameter sind immer strings true falsefalse unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type beispiel kommandos change value { "type" "change value", "parameters" { "thingid" "e173aac8 820d 4eaf b862 fb6f415b34d0", "channelid" "dimmer", "newvalue" "73" } } auto pairing { "type" "auto pairing", "parameters" { "pairingenabled" "true", "targetgrpid" "0", "enabledforsec" "90" } } delete thing { "type" "delete thing", "parameters" { "thingid" "e173aac8 820d 4eaf b862 fb6f415b34d0" } } status topic über das status topic, welches in der konfiguration als "status topic" hinterlegt ist, werden status informationen zum gateway übertragen insbesondere der online status hat hier besondere bedeutung dieser gibt an ob das gateway mit dem mqtt broker verbunden ist falls das gateway nicht mit dem broker verbunden ist, wird die event id der status nachricht auf "disconnect" gesetzt und der timestamp auf 1 dies kann innerhalb von 24 stunden mehrfach auftreten! status objekt true falsefalse unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type status objekt beispiele verbunden { 	"nodeid" "acdbda59eb17", 	"eventid" "oi2advu5fmptvmk6", 	"timestamp" 1649843546682, 	"version" "3 3 1", 	"connected" true, 	"metainfos" {} } getrennt { 	"nodeid" "acdbda59eb17", 	"eventid" "disconnect", 	"timestamp" 1, 	"version" "3 3 1", 	"connected" false, 	"metainfos" {} } benachrichtigungs topic über das benachrichtigungs topic, welches in der konfiguration als "notification topic" hinterlegt ist, werden push benachrichtigungen übertragen die push benachrichtigungen müssen für den unter "user" ausgewählten benutzer bestimmte sein benachrichtigungs objekt true falsefalse unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type beispiel benachrichtigungs objekt benachrichtigungs objekt { 	"nodeid" "acdbda59eb17", 	"eventid" "ce40i927ri52lcm7", 	"timestamp" 1649843666187, 	"msg" "admin\@smartnode dies ist eine testnachricht\n\nder test wurde erfolgreich durchgeführt\nzeilenumbrüche sind erlaubt" }