Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Fragen / Antworten rund um die neue Alias Funktion

    NEWS

    • ioBroker goes Matter ... Matter Adapter in Stable

    • 15. 05. Wartungsarbeiten am ioBroker Forum

    • Monatsrückblick - April 2025

    Fragen / Antworten rund um die neue Alias Funktion

    This topic has been deleted. Only users with topic management privileges can see it.
    • apollon77
      apollon77 @liv-in-sky last edited by

      @liv-in-sky am besten lege deine Erkenntnisse mal als issue im Controller an. Am Ende müssen wir immer beim setzen von zielstates von einem alias aus prüfen ob es zum Ziel ein Objekt gibt. Nicht bei der Anlage. Sondern beim Wert setzen.

      Bzw dein Skript müsste neben der existiert von state Werten prüfen ob es auch ein passendes Objekt gibt.

      Am Ende entstehen bei sowas gerade Geister State werte ohne Objekt. Und das spiegelt das gut wieder was du beschreibst.

      Müssen wir mal überlegen wie wir das behandeln können am besten.

      liv-in-sky 1 Reply Last reply Reply Quote 0
      • liv-in-sky
        liv-in-sky @apollon77 last edited by liv-in-sky

        @apollon77 ich mach ein git auf

        ich prüfe übrigends den state an dieser stelle nicht ab sondern ob es ein dp-object gibt

        erst später bzw seperat wird überprüft, ob alle datenpunkte auch statewerte haben - aber nicht bei aliasen!

        danke dir

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

          @marcuskl sagte:

          Ah jetzt hat sich es grad irgentwie aktualisiert und er ist da
          Komisch

          Der Wert eines neuen Datenpunktes wird nicht gleich im Admin, Reiter "Objekte" angezeigt. Am schnellsten kommt man zu einer Wertanzeige, wenn man den Admin in einem neuen Browser-Tab öffnet. Getestet habe ich es mit folgendem Beispiel, in dem ein String-Datenpunkt, der nur die Werte "Aus" und "Ein" hat, in einen Logikwert gewandelt wird.

            "common": {
              "name": "Bad.Licht.Deckenlampe",
              "role": "switch",
              "type": "boolean",
              "desc": "Wandlung aus String Aus/Ein",
              "alias": {
                "id": "meineDP.0.ch2.on_off",
                "read": "val == 'Aus' ? false : true",
                "write": "val ? 'Ein' : 'Aus'"
              },
              "read": true,
              "write": true,
              "def": false
            },
            "native": {},
          
          apollon77 1 Reply Last reply Reply Quote 0
          • apollon77
            apollon77 @paul53 last edited by

            @paul53 "on"/"off" sollte automatisch konvertiert werden! Da brauchst Du an sich keine read/write function. Es reicht wenn die Datentypen boolean/string sind bei target/source

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

              @apollon77 sagte:

              Da brauchst Du an sich keine read/write function. Es reicht wenn die Datentypen boolean/string sind bei target/source

              Ja, ich weiß, wollte es aber mal mit "read" und "write" testen - eigentlich mit einem Datenpunkt "Aus"/"Ein", den ich aber erst hätte erstellen müssen. Ich passe es mal in meinem Beispiel oben an.

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

                @paul53 ;.) "Ein"/"Aus" geht auch automatisch gg

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

                  @apollon77 sagte:

                  "Ein"/"Aus" geht auch automatisch

                  Wirklich ?

                              if (state.val === 'off' || state.val === 'OFF' || state.val === 'AUS' || state.val === 'aus' || state.val === 0 || state.val === '0') {
                  
                  apollon77 1 Reply Last reply Reply Quote 0
                  • apollon77
                    apollon77 @paul53 last edited by

                    @paul53 ooooojhkkk ... "Aus" nicht ... ich baue es noch in ein lowercase um 🙂

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

                      @apollon77
                      Die Abfrage

                      state.val === 0
                      

                      kann man weglassen, denn der Fall wird abgedeckt durch

                      else state.val = !!state.val;
                      
                      apollon77 1 Reply Last reply Reply Quote 0
                      • apollon77
                        apollon77 @paul53 last edited by

                        @paul53 korrekt

                        1 Reply Last reply Reply Quote 0
                        • X
                          Xyolyp last edited by Xyolyp

                          Ich habe nach dem Update auf den JS-Controller 2.1 einige meiner Skripte umgestellt, so dass jetzt 0_userdata.0 sowie die Alias (anstatt der LinkedDevices Adapter) genutzt wird.
                          0_userdata.0 funktioniert genau wie erwartet; Alias praktisch gar nicht.
                          Im Objektbaum werden die richtigen Werte angezeigt und auch bei Änderungen funktioniert es in beide Richtungen (schreiben auf Alias, sowie schreiben auf Originaldatenpunkt). Sobald aber ein Skript einen Aliasdatenpunkt nutzen soll funktioniert es nicht mehr. Die Trigger lösen nicht aus, wenn ein Skript versucht einen Aliasdatenpunkt zu lesen (gewählt via Objektbaum-Popup im Blockly), den es definitiv gibt, so schlägt es fehl mit folgendem Log:

                          javascript.0	2019-11-17 15:00:35.508	warn	(770) at processImmediate (timers.js:658:5)
                          javascript.0	2019-11-17 15:00:35.507	warn	(770) at tryOnImmediate (timers.js:676:5)
                          javascript.0	2019-11-17 15:00:35.506	warn	(770) at runCallback (timers.js:705:18)
                          javascript.0	2019-11-17 15:00:35.506	warn	(770) at Immediate.setImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/states/statesInRedis.js:224:41)
                          javascript.0	2019-11-17 15:00:35.505	warn	(770) at change (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:4744:37)
                          javascript.0	2019-11-17 15:00:35.504	warn	(770) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:364:25)
                          javascript.0	2019-11-17 15:00:35.503	warn	(770) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:973:38)
                          javascript.0	2019-11-17 15:00:35.502	warn	(770) at Object.<anonymous> (script.js.Phone.Announce_Call:7:55)
                          javascript.0	2019-11-17 15:00:35.500	warn	(770) getState "alias.0.Anwesenheit.Laura" not found (3)
                          javascript.0	2019-11-17 15:00:35.499	warn	(770) at processImmediate (timers.js:658:5)
                          javascript.0	2019-11-17 15:00:35.499	warn	(770) at tryOnImmediate (timers.js:676:5)
                          javascript.0	2019-11-17 15:00:35.498	warn	(770) at runCallback (timers.js:705:18)
                          javascript.0	2019-11-17 15:00:35.497	warn	(770) at Immediate.setImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/states/statesInRedis.js:224:41)
                          javascript.0	2019-11-17 15:00:35.497	warn	(770) at change (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:4744:37)
                          javascript.0	2019-11-17 15:00:35.496	warn	(770) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:364:25)
                          javascript.0	2019-11-17 15:00:35.495	warn	(770) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:973:38)
                          javascript.0	2019-11-17 15:00:35.494	warn	(770) at Object.<anonymous> (script.js.Phone.Announce_Call:7:7)
                          javascript.0	2019-11-17 15:00:35.490	warn	(770) getState "alias.0.Anwesenheit.Jonathan" not found (3)
                          


                          Platform: linux
                          Architecture: arm
                          CPUs: 4
                          Speed: 1200 MHz
                          Model: ARMv7 Processor rev 4 (v7l)
                          RAM: 926 MB 
                          System uptime: 02:45:28
                          Node.js: v10.17.0
                          NPM: 6.12.1
                          Disk size: 14.5 GiB
                          Disk free: 10.8 GiB
                          adapters count: 260
                          Uptime: 02:42:30
                          Active instances: 16
                          



                          b85b398c-01a5-4cec-81ff-8c1245905e99-image.png

                          {
                           "from": "system.adapter.admin.0",
                           "user": "system.user.admin",
                           "ts": 1573998134012,
                           "common": {
                             "name": "Laura",
                             "role": "indicator.presence",
                             "type": "boolean",
                             "alias": {
                               "id": "tr-064.0.devices.HUAWEI-Mate-10-lite-584e2.active"
                             }
                           },
                           "native": {},
                           "acl": {
                             "object": 1636,
                             "owner": "system.user.admin",
                             "ownerGroup": "system.group.administrator",
                             "state": 1636
                           },
                           "_id": "alias.0.Anwesenheit.Laura",
                           "type": "state"
                          }
                          

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

                            Welche Version des JavaScript Adapters ist im Einsatz?

                            X 1 Reply Last reply Reply Quote 0
                            • X
                              Xyolyp @apollon77 last edited by Xyolyp

                              @apollon77 Script engine ist in Version 4.1.14 installiert.
                              Edit: falscher Adaptername

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

                                @Xyolyp Ich meine den "Javascript" ("Script Engine" seit neuestem) Adapter

                                X 1 Reply Last reply Reply Quote 0
                                • X
                                  Xyolyp @apollon77 last edited by

                                  @apollon77 den meinte ich auch. Habe nur den falschen Namen geschrieben

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

                                    @Xyolyp Update mal auf was aktuelles bitte ... der ist recht alt. Könnte mir vorstellen das es ggf mit daran liegt

                                    X 1 Reply Last reply Reply Quote 0
                                    • X
                                      Xyolyp @apollon77 last edited by

                                      @apollon77 im stable ist 4.1.12 der aktuellste. Aktuell bewege ich mich mit meinem System immer mehr in Richtung "nur noch stable", da mein Verständnis von stable ist, dass da keine Experimente passieren, sondern die Funktionalität, die vom Adapterentwickler in der Version beworben wird funktioniert.
                                      Auf welche Version sollte ich denn aktualisieren, damit es funktioniert?

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

                                        @Xyolyp Ich sage es mal so: Wir haben währendder Entwicklung üblicherweise mit javascript 4.3.x getestet was aktuell "latest". Müsste man halt jetzt mal checken ob es da tut.Dann muss das noch fix ins Stable 🙂

                                        X 1 Reply Last reply Reply Quote 1
                                        • X
                                          Xyolyp @apollon77 last edited by

                                          @apollon77 mit der Script Engine v 4.3.2 haben die ersten zwei, drei Tests funktioniert.

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

                                            @Xyolyp Also müssen wir wohl doch für Alias noch javascript im Stable updaten ... hm .... ok!!

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate
                                            FAQ Cloud / IOT
                                            HowTo: Node.js-Update
                                            HowTo: Backup/Restore
                                            Downloads
                                            BLOG

                                            923
                                            Online

                                            31.6k
                                            Users

                                            79.5k
                                            Topics

                                            1.3m
                                            Posts

                                            alias js-controller
                                            85
                                            610
                                            128661
                                            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