NEWS
Aus Adapter Zugriff auf Breitengrad, Längengrad
-
Hallo,
ich möchte in einem Adapter auf die Konfigurationsdaten der Basiseinstellungen (Breitengrad, Längengrad zugreifen)Beispiel in main.js des Adapters:
let systemConfig = this.getObject('system.config');
liefert undefined!
Danke!
-
@peter_n Die Lösung lautet:
getForeignObject
-
Danke!
Aber irgendwas passt noch nicht: 'system.adapter.config' und 'system.config' liefern systemConfig = "undefined"let systemConfig = this.getForeignObject('system.adapter.config', () => { if (this.systemConfig) { this.log.debug(`latitude: ${systemConfig.common.latitude}`); this.log.debug(`longitude: ${systemConfig.common.longitude}`); } else { this.log.debug(`this.systemConfig: ${this.systemConfig}`); } });
-
Ok! Now its working
this.getForeignObject('system.config', (err, data) => { if (data && data.common) { this.longitude = data.common.longitude; this.latitude = data.common.latitude; } })
Thanks