@denjo Habe heute ein wenig Zeit gefunden ein wenig rumzubasteln. Vielleicht hilft dir folgender Code weiter, er ermöglicht es dir alle Daten des Smartlocks auszulesen (Es schreibt die aktuellen Werte in Objekte).
Das gleiche ist auch für Accounts, Authentifikationen, Users & Logs möglich.
const Nuki = require("nuki-web-api");
var nuki = new Nuki("dein_api_key_hier_einsetzen"); //<---------------------------------
var nuki_path = "0_userdata.0.nuki"; //Pfad für die Objekte & in Instanzen -> JavaScript -> setObject erlauben
schedule('*/20 * * * * *', function () {
updateSmartlocks();
});
function updateSmartlocks(){
nuki.getSmartlocks().then(function(res) {
checkFolder(nuki_path + ".smartlocks");
for(var i in res){
checkFolder(nuki_path + ".smartlocks." + res[i].smartlockId);
for(var x in res[i]){
if(typeof res[i][x] === 'object'){
checkFolder(nuki_path + ".smartlocks." + res[i].smartlockId + "." + x);
for(var n in res[i][x])
updateObject(nuki_path + ".smartlocks." + res[i].smartlockId + "." + x + "." + n, x, res[i][x][n]);
} else updateObject(nuki_path + ".smartlocks." + res[i].smartlockId + "." + x, x, res[i][x]);
}
}
}).catch(function(e) {console.error('updateSmartlocks(): ' + e.message)});
}
function checkFolder(path, createName){
if(!existsObject(path))
setObject(path, {type: 'folder',common: {name: createName},native: {}});
}
function updateObject(path, createName, value){
if(!existsState(path))
createState(path, value, {type: typeof value, name: createName});
else setState(path, value);
}