Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. [gelöst] You are assigning a undefined to the

    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] You are assigning a undefined to the

    This topic has been deleted. Only users with topic management privileges can see it.
    • Asgothian
      Asgothian Developer @skokarl last edited by

      @skokarl Bist du sicher das Artist im JSON ein String ist ?

      Setz doch mal den State nicht mit tablet.artist sondern mit JSON.stringify(Tablet.

      A.

      S 1 Reply Last reply Reply Quote 0
      • S
        skokarl @Asgothian last edited by skokarl

        @Asgothian

        das ist ja ne coole Idee, hab ich gar nicht dran gedacht.
        Probiere ich sobald ich wieder zu Hause bin.

        Aber wenn kein String was könnte es sonst sein ??

        Asgothian 1 Reply Last reply Reply Quote 0
        • Asgothian
          Asgothian Developer @skokarl last edited by

          @skokarl meine Vermutung: ein Array, für den Fall das ein Musikstück von 2 Künstlern zusammen gespielt wird.

          A.

          S 1 Reply Last reply Reply Quote 0
          • S
            skokarl @Asgothian last edited by

            @Asgothian

            hatte ich das richtig verstanden ?

            geht so nicht.

            1.PNG

            Asgothian 1 Reply Last reply Reply Quote 0
            • Asgothian
              Asgothian Developer @skokarl last edited by

              @skokarl
              Da fehlt eine ) am Ende.

              setState("javascript.0.sonos.artist", JSON.stringify(tablet.artist));
              

              A.

              S 1 Reply Last reply Reply Quote 0
              • S
                skokarl @Asgothian last edited by skokarl

                @Asgothian

                Wie blöd, Sorry.

                Ne, geht trotzdem nicht. Ich werd weich.

                setState("javascript.0.sonos.artist", JSON.stringify(tablet.artist));
                
                14:43:33.136	warn	javascript.0 at Request._callback (script.js.sonos.sonos_state:28:15)
                

                LOG :

                javascript.0	2019-08-25 14:43:33.131	warn	at Request.self.callback (/opt/iobroker/node_modules/iobroker.javascript/node_modules/request/request.js:185:22)
                javascript.0	2019-08-25 14:43:33.131	warn	at Request._callback (script.js.sonos.sonos_state:28:15)
                javascript.0	2019-08-25 14:43:33.131	warn	at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1276:20)
                javascript.0	2019-08-25 14:43:33.130	warn	You are assigning a undefined to the state "javascript.0.sonos.artist" which expects a string. Please fix your code to use a string or change the state type to undefined.
                
                
                Asgothian paul53 2 Replies Last reply Reply Quote 0
                • Asgothian
                  Asgothian Developer @skokarl last edited by

                  @skokarl
                  Mach doch mal eine debug Ausgabe mit JSON.stringify(tablet) damit du siehst was da wirklich drin steht.

                  A.

                  1 Reply Last reply Reply Quote 1
                  • paul53
                    paul53 @skokarl last edited by paul53

                    @skokarl sagte:

                    geht trotzdem nicht.

                    Füge mal

                    log(result);
                    

                    ein, um zu sehen, ob "artist" überhaupt übergeben wird und wenn ja, was übergeben wird.

                    1 Reply Last reply Reply Quote 0
                    • paul53
                      paul53 @skokarl last edited by

                      @skokarl sagte:

                      da kommen die Daten her :

                      Dann muss die Auswertung von "artist" so erfolgen:

                      setState("javascript.0.sonos.artist", tablet.currentTrack.artist);
                      
                      1 Reply Last reply Reply Quote 1
                      • S
                        skokarl last edited by

                        @paul53

                        Hallo Paul, meine Frau fragt gerade ob Du eigentlich manchmal denkst was für Vollpfosten hier fragen ....😂

                        Ich war eben noch am schreiben als Deine Antwort kam,
                        und wollte Dich fragen ob es sowas wie Untervariablen in Javascript gibt.

                        Ich hatte mir die Daten nochmal mit der http Adresse angesehen und da ist mir auch
                        aufgefallen das Volume in der "root" ist, artist oder stationName aber nicht...

                        Geht. Vielen lieben Dank.

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        789
                        Online

                        31.8k
                        Users

                        80.0k
                        Topics

                        1.3m
                        Posts

                        javascript
                        3
                        11
                        530
                        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