Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Error/Bug
    4. [Gelöst]ObjectId (von Wiffi-WZ-Adapter) triggert Script nicht

    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

    SOLVED [Gelöst]ObjectId (von Wiffi-WZ-Adapter) triggert Script nicht

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

      @coyote Bau mal ein Log vor die Abfrage if(sonne == false) ein.

      log('Sonne: ' + sonne + ' Typ: ' + typeof sonne);
      
      coyote 1 Reply Last reply Reply Quote 0
      • coyote
        coyote Most Active @paul53 last edited by

        @paul53

        on("telegram.0.communicate.request", function (obj) {
           if  (obj.newState.val == "[Frank]sonne") {  //Telegram anfragen
           var sonne = getState('wiffi-wz.0.root.192_168_66_134.w_sonne_scheint').val;
           log("test");
           log(sonne);
           if (sonne == false){
               log(getState('wiffi-wz.0.root.192_168_66_134.w_sonne_scheint').val);
            sendTo('telegram', getState('wiffi-wz.0.root.192_168_66_134.w_sonne_scheint'/*16*/).val);
           }
           }
        });
        

        Test kommt im Log an, log für sonne nicht

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

          @coyote sagte:

          Test kommt im Log an, log für sonne nicht

          Das glaube ich nicht. Erweitere bitte das log(sonne):

             log(sonne + typeof sonne);
          
          coyote 1 Reply Last reply Reply Quote 0
          • coyote
            coyote Most Active @paul53 last edited by

            @paul53 😁 ich glaube es ja auch nicht, ist aber so.

            Jetzt kommt im log: falsestring

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

              @coyote sagte:

              Jetzt kommt im log: falsestring

              Da haben wir es: Die Abfrage muss lauten

                 if (sonne == 'false') {
              
              coyote 1 Reply Last reply Reply Quote 0
              • coyote
                coyote Most Active @paul53 last edited by

                @paul53 ja nach deiner Erweiterung des Logs, war mir das auch fast klar, nur stimmt doch dann im Adapter was nicht oder?
                Soll ja eigentlich kein String sein, sonder ein bool Wert

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

                  @coyote sagte:

                  Soll ja eigentlich kein String sein, sonder ein bool Wert

                  Welchen Typ hat der Datenpunkt ?

                  coyote 1 Reply Last reply Reply Quote 0
                  • coyote
                    coyote Most Active @paul53 last edited by

                    @paul53 Typ ist "state" und laut Raw Daten ein "boolean" Wert. Das wundert mich ja so.

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

                      @coyote sagte:

                      ein "boolean" Wert.

                      Dann liegt der Fehler im Adapter.

                      coyote 1 Reply Last reply Reply Quote 0
                      • coyote
                        coyote Most Active @paul53 last edited by

                        @paul53 denke auch, hier nochmal die Raw Daten:

                        {
                          "user": "system.user.admin",
                          "from": "system.adapter.wiffi-wz.0",
                          "ts": 1559584147719,
                          "common": {
                            "name": 16,
                            "desc": "sonne_scheint",
                            "unit": "",
                            "role": "indicator",
                            "id": "w_sonne_scheint",
                            "type": "boolean",
                            "read": true,
                            "write": false
                          },
                          "native": {},
                          "acl": {
                            "object": 1636,
                            "owner": "system.user.admin",
                            "ownerGroup": "system.group.administrator",
                            "state": 1636
                          },
                          "_id": "wiffi-wz.0.root.192_168_66_134.w_sonne_scheint",
                          "type": "state"
                        }
                        
                        smartboart 2 Replies Last reply Reply Quote 0
                        • smartboart
                          smartboart @coyote last edited by smartboart

                          @coyote
                          habe das selbe Problem seit dem Update des Weatherman auf die neuste Firmware...
                          hab die ganze Nacht nach dem Problem gesucht...
                          hier ein Screenshot mit dem Unterschied der Raw Daten zu alt und Neu...bei neuer FW kam eine Reihe hinzu...

                          neu.PNG alt.PNG

                          Denke der Adapter muss hier an die neue FW des Weatherman angepasst werden...
                          Beispiel geht nicht:
                          var Regen beachten

                          if (Regen ===true || Sturm > 3 || (working === false && Pos > 1 && Rolladen === 0 && Sonne === false && Automatik))  {
                          			    setState(idMarkise, 0);
                          

                          Beispiel geht:
                          var Regen beachten

                          if (Regen || Sturm > 3 || (working === false && Pos > 1 && Rolladen === 0 && Sonne === false && Automatik))  {
                          			    setState(idMarkise, 0);
                          
                          if (Regen === 'true' || Sturm > 3 || (working === false && Pos > 1 && Rolladen === 0 && Sonne === false && Automatik))  {
                          			    setState(idMarkise, 0);
                          
                          1 Reply Last reply Reply Quote 0
                          • smartboart
                            smartboart @coyote last edited by

                            @coyote sind alle States des wheatherman davon betroffen?

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

                              @smartboart Das lässt sich mit einem Testskript leicht überprüfen.

                              function checkType(id) {
                                 log('ID: ' + id + ' Solltyp: ' + getObject(id).common.type + ' Isttyp: ' + typeof getState(id).val);
                              }
                              
                              // richtige Datenpunkt-IDs einsetzen !
                              checkType('1. ID');
                              checkType('2. ID');
                              // usw.
                              
                              smartboart 1 Reply Last reply Reply Quote 0
                              • smartboart
                                smartboart @paul53 last edited by smartboart

                                @paul53 said in [Gelöst]ObjectId (von Wiffi-WZ-Adapter) triggert Script nicht:

                                function checkType(id) {

                                Danke werde es mal testen. Bis jetzt weiss ich aber das auch Zahlenwerte betroffen sind...Windstärke , Feuchtigkeit,Temperatur usw...
                                Im Prinzip muss ich alle meine Skript anpassen in welchen ich die States des Weatherman verwende...Hätte das FW Update lassen sollen. Der Grund war eben die bessere Regenerkennung...

                                Hab den Entwickler mal angeschrieben ob er was machen möchte...Hatte seiner Zeit den Waetherman für ihn getestet bzw. die Integration des Weatherman in den Adapter...
                                Update:

                                Hier der Log der Datenpunkte welche ich verwende..

                                8:53:07.319	info	javascript.0 Start javascript script.js.common.Test.Test
                                18:53:07.320	info	javascript.0 script.js.common.Test.Test: ID: wiffi-wz.0.root.192_168_1_52.w_regenmelder Solltyp: boolean Isttyp: string
                                18:53:07.320	info	javascript.0 script.js.common.Test.Test: ID: wiffi-wz.0.root.192_168_1_52.w_windstaerke Solltyp: number Isttyp: string
                                18:53:07.320	info	javascript.0 script.js.common.Test.Test: ID: wiffi-wz.0.root.192_168_1_52.w_lux Solltyp: number Isttyp: string
                                18:53:07.320	info	javascript.0 script.js.common.Test.Test: ID: wiffi-wz.0.root.192_168_1_52.w_sonne_scheint Solltyp: boolean Isttyp: string
                                18:53:07.320	info	javascript.0 script.js.common.Test.Test: ID: wiffi-wz.0.root.192_168_1_52.w_temperatur Solltyp: number Isttyp: string
                                18:53:07.320	info	javascript.0 script.js.common.Test.Test: ID: wiffi-wz.0.root.192_168_1_52.w_feuchte_rel Solltyp: number Isttyp: string
                                18:53:07.320	info	javascript.0 script.js.common.Test.Test: registered 0 subscriptions and 0 schedules
                                
                                
                                paul53 1 Reply Last reply Reply Quote 0
                                • paul53
                                  paul53 @smartboart last edited by paul53

                                  @smartboart sagte:

                                  Hier der Log der Datenpunkte

                                  Offenbar werden alle Werte als String geliefert. Bei Zahlen hilft parseFloat(), bei boolean Werten kann man die undokumentierte Funktion toBoolean() des JS-Adapters nutzen.

                                  smartboart 1 Reply Last reply Reply Quote 0
                                  • coyote
                                    coyote Most Active last edited by

                                    @smartboart aha ok, gut dass du mal alle Datenpunkte angeschaut hast. Es kommt ja dann wohl alles als String zurück. Welche Version hast du auf dem weatherman? 107? Der Adapterentwickler ist aber wohl auch dran, zumindest gibt es ein Issue auf GitHub, da hab ich auch schon was dazu geschrieben. Ich sollte eine neue Version testen, jedoch war es da unverändert, die Werte waren immer noch String

                                    smartboart 1 Reply Last reply Reply Quote 0
                                    • smartboart
                                      smartboart @coyote last edited by smartboart

                                      @coyote ja die 107...hatte mich lange gegen ein update gewehrt, weil ab einem bestimmten Update auch state Namen geändert wurden. Deshalb kann ich nicht sagen obe auch vorherige Versionen davon betroffen sind... Der Wiffi WZ macht immernoch alles wie er soll mit der neusten Firmware..

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

                                        @paul53 ja im moment helfe ich mir indem ich überall ein hochkomma setze..
                                        'true' / 'Zahl' / 'false'

                                        Das scheint zu funktionieren...

                                        paul53 1 Reply Last reply Reply Quote 0
                                        • coyote
                                          coyote Most Active @smartboart last edited by

                                          @smartboart OK hab auch die 107 drauf. Ja das stimmt, da ist bisschen was geändert worden, der Adapter Entwickler von wiffi-wz weiß das aber auch und die Namen müssten dort auch schon angepasst sein, nur die Werte passen eben noch nicht bzw der Typ

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

                                            @smartboart sagte:

                                            indem ich überall ein hochkomma setze..

                                            Und wenn die nächste Version Zahlen und boolsche Werte liefert, machst Du alles wieder rückgängig ? Die Umwandlung stört auch nicht, wenn es keine Strings sind.

                                            Der Vergleich

                                            Sturm > '3'
                                            

                                            wird nicht funktionieren, da z.B. '10' kleiner ist als '3'.

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            791
                                            Online

                                            31.8k
                                            Users

                                            80.0k
                                            Topics

                                            1.3m
                                            Posts

                                            datenpunkte problem script wiffi-wz
                                            3
                                            37
                                            1669
                                            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