Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Entwicklung
    4. Adapter bringt Fehler im Log - [getStates] Invalid callback

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Adapter bringt Fehler im Log - [getStates] Invalid callback

    This topic has been deleted. Only users with topic management privileges can see it.
    • SKB
      SKB Developer Most Active last edited by SKB

      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);
              }
      
      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      Support us

      ioBroker
      Community Adapters
      Donate

      805
      Online

      31.7k
      Users

      79.8k
      Topics

      1.3m
      Posts

      1
      1
      154
      Loading More Posts
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      Community
      Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
      The ioBroker Community 2014-2023
      logo