NEWS
Adapter bringt Fehler im Log - [getStates] Invalid callback
-
Hallo Entwickler-Kollegen,
ich schreibe gerade den Adapter "Energiefluss" und habe eine HTML Seite (tab_m.html) für die Seitenlasche eingepflegt.
Diese soll einen State abholen und darstellen.Der state wird abgeholt - jedoch meldet das Admin log:
admin.0 2022-06-15 11:44:47.940 warn [getStates] Invalid callback
Der Aufruf innerhalb gleich sich mit meiner Instanz-Seite.
// config let html; servConn.namespace = 'energiefluss.0'; let objID = servConn.namespace + '.HTML'; var loaded = false; var states = []; servConn.init({ connLink: window.location.href.substr(0, window.location.href.indexOf('/', 8)) }, { onConnChange: function (isConnected) { if (isConnected) { console.log('connected'); servConn.getStates(objID, function (err, states) { var count = 0; for (var id in states) { count++; } if (count > 0) { console.log('Received ' + count + ' states.'); console.log('Polling active!'); html = states[objID].val; $('#loading').addClass('hidden'); updateHTML(); } }); } else { console.log('disconnected'); } }, onRefresh: function () { window.location.reload(); }, onUpdate: function (id, state) { setTimeout(function () { states[id] = state; if (id == objID) { html = states[id].val; updateHTML(); } }, 0); }, onError: function (err) { window.alert(_('Cannot execute %s for %s, because of insufficient permissions', err.command, err.arg), _('Insufficient permissions'), 'alert', 600); } }); function updateHTML() { $("#html_display").html(html); }