Drittsystemanbindung Divera 24/7

Drittsystemanbindung Divera 24/7

Um Alarme von Divera 24/7 mittels der Drittsystemanbindung empfangen zu können, eine Dateiübergabe mittels LUA-Script eingebunden werden, sowie die Konfiguration in FE2 vorgenommen werden.

Um die Anbindung vorzunehmen, benötigt jeder Kunde von uns Zugangsdaten für die Verbindung zwischen den beiden Servern.

Hierzu bitte ein Ticket bei uns eröffnen.

Konfiguration Divera 24/7

Dies kann in der Weboberfläche von Divera 24/7 unter Verwaltung->Einstellungen->Schnittstellen->Datenübergabe eingestellt werden.

image-20251201-130331.png

Dort muss nun eine Vorlage definiert werden.

image-20251201-130404.png

In der Konfiguration der Vorlage muss unter Konfiguration ein Titel vergeben werden, und unter unterstützte Events “Erstellung” und “Aktualisierung” aktiviert werden.

Das folgende Script ist von uns nur exemplarisch dargestellt.

Bei Problemen muss sich der DIVERA-Lizenzinhaber bitte an Divera wenden.

Unter “Eingabeparameter” das folgende eingetragen werden:

[ { "type": "password", "key": "apiKey", "label": "API Key *" }, { "type": "text", "key": "fe2Id", "label": "FE2-Identifikation *" }, { "type": "text", "key": "customerId", "label": "Kunden-Identifikation" }, { "type": "password", "key": "password", "label": "Verschlüsselungspasswort * (min. 16 Zeichen)" }, { "type": "text", "key": "partnerName", "label": "Partner-Name" } ]

Und unter “Script” dieses Script:

local fetch = require "fetch" local json = require "json" local encoding = require "encoding" local crypto = require "crypto" local function isEmpty(value) return value == "" or value == nil or value == json.null end assert(event.model == "alarm", "Nur Alarm Events werden unterstützt") assert(not isEmpty(configuration.fe2Id), "FE2-Identifikation muss gesetzt sein") assert(not isEmpty(configuration.apiKey), "API Key muss gesetzt sein") assert(not isEmpty(configuration.customerId), "Kunden-Identifikation") assert(not isEmpty(configuration.password), "Verschlüsselungspasswort muss gesetzt sein") assert(typeof(configuration.password) == "string" and configuration.password:len() >= 16, "Verschlüsselungspasswort muss min. 16 Zeichen lang sein") configuration.partnerName = configuration.partnerName or "DIVERA 24/7" local alarm = event.payload local externalId = `{alarm.id}` if not isEmpty(alarm.foreign_id) then externalId = alarm.foreign_id end local payload = { type = "ALARM", timestamp = alarm.ts_update, sender = configuration.sender or `DIVERA Einheit {alarm.cluster_id}`, authorization = configuration.authorization, data = { externalId = externalId, message = { alarm.text }, keyword = alarm.title }, units = { { address = "BK1" } } } payload.data.location = {} if not isEmpty(alarm.lat) and not isEmpty(alarm.lng) then payload.data.location.coordinate = { alarm.lng, alarm.lat } end if not isEmpty(alarm.address) then payload.data.custom = { location_dest = alarm.address } end local password = crypto.subtle.importKey("raw", configuration.password, "PBKDF2", false) local salt = crypto.getRandomValues(buffer.create(64)) local key = crypto.subtle.deriveKey({ name = "PBKDF2", hash = "SHA-1", salt = salt, iterations = 5000 }, password, { name = "AES-CBC", length = 256 }, false) local iv = crypto.getRandomValues(buffer.create(16)) local encryptedMessage = crypto.subtle.encrypt( { name = "AES-CBC", iv = iv }, key, json.encode(payload) ) local cloudPayload = { iv = encoding.encode("BASE64", iv), salt = encoding.encode("BASE64", salt), encryptedMessage = encoding.encode("BASE64", encryptedMessage), nameOfPartner = configuration.partnerName, apiKey = configuration.apiKey, topic = `{configuration.fe2Id}{configuration.customerId}`, messageIdentifier = crypto.randomUUID() } print(json.encode(cloudPayload)) local url = "https://tpac.alamos-gmbh.bayern/thirdparty/alarm" local response = fetch.post(url, { contentType = "application/json", data = json.encode(cloudPayload) }) print(response.body)

Sobald dies geschehen ist, kann eine neue Instanz mit den Parametern aus FE2 hinzugefügt werden.

image-20251201-130604.png

Konfiguration in FE2:

In FE2 muss unter Administration/Alarmeingang ein neuer Alarmeingang “Drittsystem-Anbindung” hinzugefügt und konfiguriert werden:

image-20251211-125354.png

Ebenso muss unter Alarmierung eine Einheit gewählt werden, an welche die Alarmierung gesendet werden soll.