Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. "steuere" mit Datentyp "object"

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    "steuere" mit Datentyp "object"

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

      Nachtrag:

      Damit bekommst du dann zumindest ein Objekt in den State geschrieben. Ob es. das "korrekte" Objekt ist hängt letztendlich vom Adapter ab. Das kann ich nicht sagen da ich diesen nicht einsetze.

      A.

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

        @matzinger sagte: Die RAW Daten des Datenpunktes sehen so aus:

        Erstelle ein Issue auf Github: common.def als String passt nicht zu common.type = "object".

        @matzinger sagte in "steuere" mit Datentyp "object":

        wieso der String plötzlich nicht mehr funktioniert,

        Funktioniert er wirklich nicht mehr? Der js-controller erzeugt (vorerst) nur eine Warnung.

        @Jey-Cee empfahl, common.type auf "string" zu ändern.

        M 1 Reply Last reply Reply Quote 0
        • M
          Matzinger @Asgothian last edited by

          @asgothian Danke schonmal. Leider klappt es so auch nicht. Ich habe das Skript wie folgt verändert:

          2319e25a-ea9e-41fa-98ab-1a3d72860bca-image.png

          und bekomme im Log dann Folgendes:

          javascript.0	2021-08-03 08:30:47.271	info	(1720) State value to set for "deconz.0.Lights.6.xy" has to be stringified but received type "object"
          javascript.0	2021-08-03 08:30:47.269	info	(1720) State value to set for "deconz.0.Lights.6.xy" has to be stringified but received type "object"
          javascript.0	2021-08-03 08:30:47.255	info	(1720) State value to set for "deconz.0.Lights.6.xy" has to be stringified but received type "object"
          javascript.0	2021-08-03 08:30:47.252	warn	(1720) at processImmediate (internal/timers.js:456:21)
          javascript.0	2021-08-03 08:30:47.252	warn	(1720) at Immediate._onImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:5706:41)
          javascript.0	2021-08-03 08:30:47.252	warn	(1720) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:502:29)
          javascript.0	2021-08-03 08:30:47.252	warn	(1720) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1075:38)
          javascript.0	2021-08-03 08:30:47.251	warn	(1720) at Object.<anonymous> (script.js.common.Skript_1LoxBettboden_temp:13:5)
          javascript.0	2021-08-03 08:30:47.251	warn	(1720) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1427:20)
          javascript.0	2021-08-03 08:30:47.249	warn	(1720) You are assigning a array to the state "deconz.0.Lights.6.xy" which expects a object. Please fix your code to use a object or change the state type to array. This warning might become an error
          javascript.0	2021-08-03 08:30:47.247	warn	(1720) at processImmediate (internal/timers.js:456:21)
          javascript.0	2021-08-03 08:30:47.247	warn	(1720) at Immediate._onImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:5706:41)
          javascript.0	2021-08-03 08:30:47.247	warn	(1720) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:502:29)
          javascript.0	2021-08-03 08:30:47.246	warn	(1720) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1075:38)
          javascript.0	2021-08-03 08:30:47.246	warn	(1720) at Object.<anonymous> (script.js.common.Skript_1LoxBettboden_temp:13:5)
          javascript.0	2021-08-03 08:30:47.245	warn	(1720) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1427:20)
          javascript.0	2021-08-03 08:30:47.244	warn	(1720) You are assigning a array to the state "deconz.0.Lights.6.xy" which expects a object. Please fix your code to use a object or change the state type to array. This warning might become an error
          javascript.0	2021-08-03 08:30:47.239	warn	(1720) at processImmediate (internal/timers.js:456:21)
          javascript.0	2021-08-03 08:30:47.239	warn	(1720) at Immediate._onImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:5706:41)
          javascript.0	2021-08-03 08:30:47.238	warn	(1720) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:502:29)
          javascript.0	2021-08-03 08:30:47.237	warn	(1720) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1075:38)
          javascript.0	2021-08-03 08:30:47.236	warn	(1720) at Object.<anonymous> (script.js.common.Skript_1LoxBettboden_temp:13:5)
          javascript.0	2021-08-03 08:30:47.235	warn	(1720) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1427:20)
          javascript.0	2021-08-03 08:30:47.231	warn	(1720) You are assigning a array to the state "deconz.0.Lights.6.xy" which expects a object. Please fix your code to use a object or change the state type to array. This warning might become an error
          

          Hab ich irgendwas falsche gemackt?

          Gruß und Danke
          Matthias

          Asgothian 1 Reply Last reply Reply Quote 0
          • M
            Matzinger @paul53 last edited by

            @paul53 also die Lampe reagiert nicht mehr und bleibt aus und der xy Wert wird rot angezeigt

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

              @matzinger sagte in "steuere" mit Datentyp "object":

              Hab ich irgendwas falsche gemackt?

              Warhrscheinlich ja, allerdings auf "Anweisung".

              Mein problem ist das ich den Adapter nicht einsetze und damit nicht weiss was der für ein Objekt erwartet. Das mit dem Array ([]) war ein Versuch.

              Ich würde vorschlagen das du erst einmal versuchst den Typ des State im Objektbaum manuell wie von @paul53 vorgeschlagen auf "string" setzt und dann schaust ob du mit dem ummodifizierten Skript die Farbe steuern kannst.

              A.

              M 1 Reply Last reply Reply Quote 0
              • M
                Matzinger @Asgothian last edited by

                @asgothian wenn ich den Typ auf "string" ändere, kommt folgende Fehlermeldung:

                deconz.0	2021-08-03 10:41:58.572	warn	(1815) {"address":"/lights/6/state","description":"invalid value, , for parameter, xy","type":7}
                
                paul53 1 Reply Last reply Reply Quote 0
                • paul53
                  paul53 @Matzinger last edited by

                  @matzinger

                  Es gibt im Prinzip 3 Möglichkeiten, wovon eine sicherlich funktioniert:

                  Bild_2021-08-03_123835.png

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

                    @paul53 Leider ergeben alle 3 Möglichkeiten nur Fehler:

                    d43d450e-04a0-4a84-b78f-6412fab399d2-image.png

                    ergibt

                    javascript.0	2021-08-03 14:05:54.750	warn	(1720) at processImmediate (internal/timers.js:456:21)
                    javascript.0	2021-08-03 14:05:54.750	warn	(1720) at Immediate._onImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:5706:41)
                    javascript.0	2021-08-03 14:05:54.749	warn	(1720) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:502:29)
                    javascript.0	2021-08-03 14:05:54.744	warn	(1720) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1075:38)
                    javascript.0	2021-08-03 14:05:54.743	warn	(1720) at Object.<anonymous> (script.js.common.Skript_1LoxBettboden_temp:13:5)
                    javascript.0	2021-08-03 14:05:54.743	warn	(1720) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1427:20)
                    javascript.0	2021-08-03 14:05:54.741	warn	(1720) You are assigning a string to the state "deconz.0.Lights.6.xy" which expects a object. Please fix your code to use a object or change the state type to string. This warning might become an erro
                    javascript.0	2021-08-03 14:05:54.736	warn	(1720) at processImmediate (internal/timers.js:456:21)
                    javascript.0	2021-08-03 14:05:54.735	warn	(1720) at Immediate._onImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:5706:41)
                    javascript.0	2021-08-03 14:05:54.735	warn	(1720) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:502:29)
                    javascript.0	2021-08-03 14:05:54.735	warn	(1720) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1075:38)
                    javascript.0	2021-08-03 14:05:54.734	warn	(1720) at Object.<anonymous> (script.js.common.Skript_1LoxBettboden_temp:13:5)
                    javascript.0	2021-08-03 14:05:54.734	warn	(1720) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1427:20)
                    javascript.0	2021-08-03 14:05:54.732	warn	(1720) You are assigning a string to the state "deconz.0.Lights.6.xy" which expects a object. Please fix your code to use a object or change the state type to string. This warning might become an erro
                    javascript.0	2021-08-03 14:05:54.729	warn	(1720) at processImmediate (internal/timers.js:456:21)
                    javascript.0	2021-08-03 14:05:54.729	warn	(1720) at Immediate._onImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:5706:41)
                    javascript.0	2021-08-03 14:05:54.728	warn	(1720) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:502:29)
                    javascript.0	2021-08-03 14:05:54.728	warn	(1720) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1075:38)
                    javascript.0	2021-08-03 14:05:54.727	warn	(1720) at Object.<anonymous> (script.js.common.Skript_1LoxBettboden_temp:18:5)
                    javascript.0	2021-08-03 14:05:54.726	warn	(1720) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1427:20)
                    javascript.0	2021-08-03 14:05:54.724	warn	(1720) You are assigning a string to the state "deconz.0.Lights.6.xy" which expects a object. Please fix your code to use a object or change the state type to string. This warning might become an erro
                    

                    0e2b63c2-a228-4244-a073-ce84ae57c636-image.png

                    ergibt:

                    javascript.0	2021-08-03 14:01:43.110	info	(1720) State value to set for "deconz.0.Lights.6.xy" has to be stringified but received type "object"
                    deconz.0	2021-08-03 14:01:43.074	warn	(1815) Code 400: Bad request set light state 6: [{"error":{"address":"/lights/6/state","description":"body contains invalid JSON","type":2}}]
                    

                    und

                    9448816c-8640-4998-8ee9-333f025dc7d0-image.png

                    erzeugt

                    javascript.0	2021-08-03 14:08:35.862	info	(1720) State value to set for "deconz.0.Lights.6.xy" has to be stringified but received type "object"
                    javascript.0	2021-08-03 14:08:35.859	warn	(1720) at processImmediate (internal/timers.js:456:21)
                    javascript.0	2021-08-03 14:08:35.859	warn	(1720) at Immediate._onImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:5706:41)
                    javascript.0	2021-08-03 14:08:35.858	warn	(1720) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:502:29)
                    javascript.0	2021-08-03 14:08:35.858	warn	(1720) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1075:38)
                    javascript.0	2021-08-03 14:08:35.857	warn	(1720) at Object.<anonymous> (script.js.common.Skript_1LoxBettboden_temp:13:5)
                    javascript.0	2021-08-03 14:08:35.857	warn	(1720) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1427:20)
                    javascript.0	2021-08-03 14:08:35.850	warn	(1720) You are assigning a array to the state "deconz.0.Lights.6.xy" which expects a object. Please fix your code to use a object or change the state type to array. This warning might become an error
                    javascript.0	2021-08-03 14:08:35.848	info	(1720) State value to set for "deconz.0.Lights.6.xy" has to be stringified but received type "object"
                    javascript.0	2021-08-03 14:08:35.845	warn	(1720) at processImmediate (internal/timers.js:456:21)
                    javascript.0	2021-08-03 14:08:35.845	warn	(1720) at Immediate._onImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:5706:41)
                    javascript.0	2021-08-03 14:08:35.845	warn	(1720) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:502:29)
                    javascript.0	2021-08-03 14:08:35.844	warn	(1720) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1075:38)
                    javascript.0	2021-08-03 14:08:35.844	warn	(1720) at Object.<anonymous> (script.js.common.Skript_1LoxBettboden_temp:13:5)
                    javascript.0	2021-08-03 14:08:35.843	warn	(1720) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1427:20)
                    javascript.0	2021-08-03 14:08:35.842	warn	(1720) You are assigning a array to the state "deconz.0.Lights.6.xy" which expects a object. Please fix your code to use a object or change the state type to array. This warning might become an error
                    javascript.0	2021-08-03 14:08:35.839	warn	(1720) at processImmediate (internal/timers.js:456:21)
                    javascript.0	2021-08-03 14:08:35.839	warn	(1720) at Immediate._onImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:5706:41)
                    javascript.0	2021-08-03 14:08:35.838	warn	(1720) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:502:29)
                    javascript.0	2021-08-03 14:08:35.838	warn	(1720) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1075:38)
                    javascript.0	2021-08-03 14:08:35.838	warn	(1720) at Object.<anonymous> (script.js.common.Skript_1LoxBettboden_temp:13:5)
                    javascript.0	2021-08-03 14:08:35.837	warn	(1720) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1427:20)
                    javascript.0	2021-08-03 14:08:35.836	warn	(1720) You are assigning a array to the state "deconz.0.Lights.6.xy" which expects a object. Please fix your code to use a object or change the state type to array. This warning might become an error
                    
                    paul53 1 Reply Last reply Reply Quote 0
                    • paul53
                      paul53 @Matzinger last edited by paul53

                      @matzinger
                      Die Warnungen kommen, wenn common.type nicht dem tatsächlichen Datentyp entspricht. Wichtig ist: Hat eine der 3 Versionen die Farbe richtig ausgegeben? Wenn ja, welche?

                      @matzinger sagte in "steuere" mit Datentyp "object":

                      info	(1720) State value to set for "deconz.0.Lights.6.xy" has to be stringified but received type "object"
                      

                      könnte bedeuten, dass aus dem Array ein JSON gemacht werden muss:

                      Bild_2021-08-03_142848.png

                      Das macht in neuer Version (ab 5.2.0) aber schon der Javascript-Adapter.
                      Update den Javascript-Adapter auf Version 5.2.8, ändere common.type in "array" (siehe Deconz) und dann:

                      Bild_2021-08-03_171014.png

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

                        @paul53 Objekt nach JSON erzeugt den gleichen Fehler wie oben.

                        javascript.0	2021-08-04 09:40:26.521	warn	(1720) at processImmediate (internal/timers.js:456:21)
                        javascript.0	2021-08-04 09:40:26.521	warn	(1720) at Immediate._onImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:5706:41)
                        javascript.0	2021-08-04 09:40:26.520	warn	(1720) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:502:29)
                        javascript.0	2021-08-04 09:40:26.520	warn	(1720) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1075:38)
                        javascript.0	2021-08-04 09:40:26.519	warn	(1720) at Object.<anonymous> (script.js.common.Skript_1LoxBettboden_temp:13:5)
                        javascript.0	2021-08-04 09:40:26.518	warn	(1720) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1427:20)
                        javascript.0	2021-08-04 09:40:26.517	warn	(1720) You are assigning a string to the state "deconz.0.Lights.6.xy" which expects a object. Please fix your code to use a object or change the state type to string. This warning might become an erro
                        javascript.0	2021-08-04 09:40:26.510	warn	(1720) at processImmediate (internal/timers.js:456:21)
                        javascript.0	2021-08-04 09:40:26.510	warn	(1720) at Immediate._onImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:5706:41)
                        javascript.0	2021-08-04 09:40:26.510	warn	(1720) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:502:29)
                        javascript.0	2021-08-04 09:40:26.509	warn	(1720) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1075:38)
                        javascript.0	2021-08-04 09:40:26.509	warn	(1720) at Object.<anonymous> (script.js.common.Skript_1LoxBettboden_temp:13:5)
                        javascript.0	2021-08-04 09:40:26.508	warn	(1720) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1427:20)
                        javascript.0	2021-08-04 09:40:26.496	warn	(1720) You are assigning a string to the state "deconz.0.Lights.6.xy" which expects a object. Please fix your code to use a object or change the state type to string. This warning might become an erro
                        

                        Das mit dem Javastript Adapter verstehe ich leider nicht. Die 5.1.3 ist die aktuelle stable version. Wenn ich den Verwahrungsort auf Beta stelle zeigt er mir als Verfügbare version 4.6.26 an

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

                          @matzinger sagte: Wenn ich den Verwahrungsort auf Beta stelle

                          Nimm den:

                          Bild_2021-08-04_104041.png

                          @matzinger sagte in "steuere" mit Datentyp "object":

                          Objekt nach JSON erzeugt den gleichen Fehler wie oben.

                          Du hast common.type nicht in "string" geändert. Die Farbe wurde aber richtig übertragen?

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

                            @paul53 Du hast Recht, das hatte ich vergessen. Dann kommt folgende Meldung:

                            deconz.0	2021-08-05 07:49:21.112	warn	(1815) {"address":"/lights/6/state","description":"invalid value, , for parameter, xy","type":7}
                            deconz.0	2021-08-05 07:49:21.099	warn	(1815) {"address":"/lights/6/state","description":"invalid value, , for parameter, xy","type":7}
                            deconz.0	2021-08-05 07:49:21.067	warn	(1815) {"address":"/lights/6/state","description":"invalid value, , for parameter, xy","type":7}
                            

                            Nach der o.g. Meldung stellt sich der Type wieder von alleine auf "object" um. Beim nächsten Ausführen kommt dann wieder die lange Fehlermeldung vom Javascript Adapter.

                            Habe den Javasript Adapter nun auf 5.2.8 aktualisiert. Wenn ich nun ein Array übergebe, bekomme ich keine Fehler oder warnungen mehr im Log. der neue xy Wert wird auch übergeben, springt allerdings danach auf rot. Die Farbe der Lampe ändert sich nicht.

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

                              @matzinger sagte: Nach der o.g. Meldung stellt sich der Type wieder von alleine auf "object" um.

                              Wirklich? Dann update den Deconz-Adapter von Github: Änderung von "xy" ist heute eingeflossen.

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

                                @paul53 ich habe nun auf 1.3.18 aktualisiert. Leider keine Änderung. Wenn ich ein Array übergebe, meckert der er, dass er ein Objekt will. Wenn ich ein JSON übergebe, schreibt er den neuen Wert zwar in den Datenpunkt, der wird aber gleich wieder rot und die Farbe der Lampe ändert sich nicht.

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

                                  @matzinger sagte: ich habe nun auf 1.3.18 aktualisiert.

                                  1.3.18 ist nicht aktuell, sondern nur die Version auf Github (über Katze installieren). Die Versionsnummer ändert sich dabei nicht.

                                  @matzinger sagte in "steuere" mit Datentyp "object":

                                  meckert der er, dass er ein Objekt will.

                                  In der Github-Version ist auf "array" korrigiert.

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

                                    @paul53 Es geht wieder!!!!

                                    Vielen vielen Dank für den Support.

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

                                    Support us

                                    ioBroker
                                    Community Adapters
                                    Donate

                                    846
                                    Online

                                    32.0k
                                    Users

                                    80.5k
                                    Topics

                                    1.3m
                                    Posts

                                    3
                                    18
                                    1131
                                    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