Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Entwicklung
    4. [gelöst]Fehler abfangen bei adapter.getObject

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst]Fehler abfangen bei adapter.getObject

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

      Hallo Leute,
      ich "kämpfe" mit einem Problem in einer Adapter-Entwicklung,
      ich mache ein var obj=getobject(id), aber die "id" ist noch nicht vorhanden,
      wie kann ich diesen Fehler abfangen?

      mickym M UncleSam 3 Replies Last reply Reply Quote 0
      • mickym
        mickym Most Active @stoffel67 last edited by

        @stoffel67 if (obj === undefined) ???

        1 Reply Last reply Reply Quote 0
        • M
          MCU @stoffel67 last edited by

          @stoffel67 existsState(id)

          S 1 Reply Last reply Reply Quote 0
          • UncleSam
            UncleSam Developer @stoffel67 last edited by

            @stoffel67 In den meisten Fällen willst du ja das Objekt anlegen, wenn es noch nicht existiert. Dann kannst du einfach updateObject() respektive updateObjectAsync() benutzen: das aktualisiert das Objekt oder erstellt es.

            Ein Beispiel:
            https://github.com/UncleSamSwiss/ioBroker.loxone/blob/221437b11e0f25b470bb1241ea06ccc43c769d9f/src/loxone-handler-base.ts#L57

            1 Reply Last reply Reply Quote 0
            • S
              stoffel67 @MCU last edited by

              @mcu
              : "ReferenceError: existsState is not defined".
              innerhalb eines Adapter scheint das nicht zu funktionieren

              1 Reply Last reply Reply Quote 0
              • S
                stoffel67 last edited by

                So, ... mein Problem war nicht das getObject... sondern die ID wird aus einem Array genommen, und zum Zeitpunkt kann es vorkommen, daß es die ID im Array noch nicht gibt,
                also ich prüfe jetzt zuerst das Array ab...

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

                Support us

                ioBroker
                Community Adapters
                Donate

                471
                Online

                31.9k
                Users

                80.2k
                Topics

                1.3m
                Posts

                adapter.getobjects
                4
                6
                252
                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