Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Entwicklung
    4. Adapter.config - undefined Problem

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Adapter.config - undefined Problem

    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Marcolotti last edited by

      Hallo nochmal,

       `1 request(url + adapter.config.devices[u].ip , function(err, stat, body) {
                2  var werte = JSON.parse(body);
               3   adapter.log.info(body);
               4   adapter.createState(null,adapter.config.device[u].name , werte.balance, 'State' );
               5   adapter.log.info(werte.balance);
      
             });`
      
      Warum klappt in Zeile 1 `~~[code]~~adapter.config.devices[u].ip` und in Zeile 4 nicht? - undefined?
      
      "uncaught exception: Cannot read property 'name' of undefined "
      
      Möchte es nur wissen. :-)
      
      Gruß Marco[/u][/code][/u][/u]
      
      1 Reply Last reply Reply Quote 0
      • apollon77
        apollon77 last edited by

        Zeig mal mehr Code drum herum. Vor allem wo “u“ herkommt

        Gesendet vom Handy …

        1 Reply Last reply Reply Quote 0
        • K
          kgerlich last edited by

          Ich glaub nicht, dass es in adapter eine function createState gibt. Die gibt's im Scriptadapter, aber nicht in einem regulären Adapter.

          setState() vielleicht?

          Kann mich natürlich auch irren, aber dann lern ich noch was. 🙂

          VG

          K.

          1 Reply Last reply Reply Quote 0
          • apollon77
            apollon77 last edited by

            Adapter.createState gibt es. Das ist nicht das Problem. Abgesehen davon das in den Objekten komplett die objektdefinition fehlt ist das generell ok. Schau doch mal im js-Controller unter lib/adapter.js durch was es so gibt 😉

            Gesendet vom Handy …

            1 Reply Last reply Reply Quote 0
            • K
              kgerlich last edited by

              Oh cool, danke, guter Tipp.

              VG

              K.

              1 Reply Last reply Reply Quote 0
              • blauholsten
                blauholsten Developer last edited by

                @apollon77:

                Zeig mal mehr Code drum herum. Vor allem wo “u“ herkommt

                Gesendet vom Handy … `

                Am wahrscheinlichsten ist wohl, das u aus einer schleife kommt, und beim Aufruf des Callbacks nicht mehr verfügbar ist. ??????

                PS: das ist nur eine Vermutung, das sollte eigentlich keine Antwort auf deine Frage sein, denn bei deinen Wissen wäere das vermessen….

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post

                Support us

                ioBroker
                Community Adapters
                Donate

                788
                Online

                31.7k
                Users

                79.8k
                Topics

                1.3m
                Posts

                4
                6
                2228
                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