Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Script fürTabelle der Batterie Zustände

    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

    Script fürTabelle der Batterie Zustände

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

      @dog-rgb

      hier bei meinem sript muss man solche sonderfälle extra coden der schwierigkeitsgrad hängt vonm den datnpunzen ab - eir sie aufgebaut sind

      es gibt noch ein anderes script : suche nach generisch batterie" - dort kann man alles einbinden

      schaur dir mal das andee scipt an - und wenn das für dich nichts ist - meld dich nochmal

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

        @liv-in-sky Danke für den Hinweis, dann werde ich mich mal mit dem anderen beschäftigen (dieses habe ich gefunden: https://forum.iobroker.net/topic/31676/vorlage-generische-batteriestandsüberwachung-vis-ausgabe)

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

          @dog-rgb genau das habe ich gemeint

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

            @Christoph1337

            bitte mal testen - zigbee und deconz sind drin - die dp angleichen und deconz aktivieren

            testBatt.txt

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

              @liv-in-sky Super!
              Leider ist das Encodung wieder zermatscht!

              liv-in-sky Negalein 2 Replies Last reply Reply Quote 0
              • liv-in-sky
                liv-in-sky @Christoph1337 last edited by

                @christoph1337

                sorry - das nervt mit dieser einschränkung

                ist hier - https://github.com/liv-in-sky/battery-iobroker-vis-table nimm das testBatt.txt

                Christoph1337 1 Reply Last reply Reply Quote 0
                • Negalein
                  Negalein Global Moderator @Christoph1337 last edited by

                  @christoph1337 sagte in Script fürTabelle der Batterie Zustände:

                  Leider ist das Encodung wieder zermatscht!

                  das liegt an der Art, wie du das ..txt öffnest.

                  Nicht einfach auf den Link klicken
                  sondern Rechtsklick, speichern unter

                  dann passt die Formatierung zu 100%

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

                    @liv-in-sky
                    919c8735-09ed-431b-89c5-f8d87b9dcf91-image.png

                    Sieht gut aus!

                    Deconz kann ich aktuell nicht mehr mit diesen, da ich da keine Sensoren mehr drin habe.

                    btw. Ich missbrauche den "homematic" Teil immer für meinem MAX Adapter. Den Max Teil den du gebaut hast funktionier für den CUL.

                    if (homematic){
                        tabelleMachSchoen()
                                 counter=-1
                        
                                  // 
                                    for(var i=0;i<mehrfachTabelle;i++ ) {
                                    val0=""; val1=""; val2="";counter++;tabelleBind();
                                  }
                                   
                                   for(var i=0;i<mehrfachTabelle;i++ ) {
                                      if(i==0){val0="<font color=\""+htmlColorDeviceUeberschrift+"\"><"+HTMLbrandSetting+">HOMEMATIC DEVICES</b>";} else{val0=""; }
                                       val1=""; val2="";counter++;tabelleBind();
                                  } 
                    
                      
                         arrDoppelt=[];
                         myObjF=[];
                    $('maxcube.*.devices.*.battery_low').each(function(id, i) {           // hier eigene schleife definieren und den wert counter++ nicht vergessen  !!!
                    
                    I 1 Reply Last reply Reply Quote 0
                    • I
                      Idefix01 @Christoph1337 last edited by

                      @liv-in-sky

                      Hallöchen, in dem Script lassen sich ja auch unerwünschte Geräte raus filtern.

                      Ich habe auch ein Hue Bewegungssensor. Dieser bringt mir allerdings zusätzlich auch noch diese zwei Batteriezustände, die identisch sind mit dem normalen Sensor Objekt (hue.0.Hue_ambient_light_sensor_1, hue.0.Hue_temperature_sensor_1).

                      Diese würde ich gern auch raus filtern, wenn das irgendwie möglich wäre.

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

                        @idefix01

                        verstehe ich nicht - du kannst doch die gesamte id in das filterarray eingeben - in anführungszeichen und mit komma getrennt

                        etwa so:

                        ["hue.0.Hue_ambient_light_sensor_1.percent"," hue.0.Hue_temperature_sensor_1.percent"]
                        
                        I 1 Reply Last reply Reply Quote 0
                        • I
                          Idefix01 @liv-in-sky last edited by

                          @liv-in-sky

                          ja das habe ich auch gemacht aber, er nimmt es nicht. Es reagiert nicht darauf und bleibt trotzdem weiter stehen

                          liv-in-sky 2 Replies Last reply Reply Quote 0
                          • liv-in-sky
                            liv-in-sky @Idefix01 last edited by

                            @idefix01 prüfe ich morgen mal

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

                              @idefix01

                              Poste doch noch was jetzt im Filterarray steht und zeige ein Bild (objecte_tab) von den dp, die du filtern willst

                              1 Reply Last reply Reply Quote 0
                              • A
                                AlexMuc81 last edited by AlexMuc81

                                Hallo zusammen,

                                obwohl bei mir ein Fensterkontakt leer ist, zeigt mir die Tabelle an, dass alles ok. ist.
                                Ich bin jetzt nicht der Profi im Programmieren, aber ich glaube es werden die falschen Datenpunkte
                                geprüft.

                                        $('hmip.*.*.0.lowBat').each(function(id, i) {  
                                             // val0=getObject(id).common.name ; 
                                               var ida = id.split('.');
                                               val0=getObject(ida[0]+"."+ida[1]+"."+ida[2]+"."+ida[3]).common.name 
                                               json1=val0;
                                               val1help=getState(id).val;
                                               if (val1help=="true") {val1=(" <font color=\"red\"> ")+"low bat"; json2="low";json5="red";json3_1=0} else{val1=(" <font color=\"lightgreen\"> ")+"full bat";json2="high";json5="green";json3_1=100} 
                                               if (val1help=="true") {val2=symbolKO;json3=symbolKO} else{val2=symbolOK;json3=symbolKO}         
                                               if (val1help=="true") AkkuAlarm.push(1);
                                               if (val1help=="true")  alarmMessage.push(val0);
                                
                                        
                                            json3=val2;
                                            json6="HOMEMATIC-IP"
                                            if (braucheMaterialDesignWidget || braucheMaterialDesignWidgetTable) {
                                              json4=json4=pfadBilderMaterialWidget+"homematick.png"
                                              makeJsonWidget(json1,json2,json3,json4,json5,json6,json3_1);}
                                        let help=[val0,val1,val2]; myObjF.push(help);
                                });
                                

                                Ist im Original script die Zeile 1161 - 1179.

                                Wenn ich bei mir jetzt die Datenobjekte anschaue, sieht der so aus bei HomematicIP

                                hmip.0.devices.*.channels.0 -> State: true

                                der * steht für die ID des Gerätes

                                Kann mir da jemand weiterhelfen?
                                Danke

                                Gruß
                                Alex

                                liv-in-sky 2 Replies Last reply Reply Quote 0
                                • liv-in-sky
                                  liv-in-sky @AlexMuc81 last edited by liv-in-sky

                                  @alexmuc81 sagte in Script fürTabelle der Batterie Zustände:

                                  der * steht für die ID des Gerätes

                                  poste mal die ganze id eines datenpunktes, der die battery anzeigt - sollte am ende: .lowBat heißen

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

                                    @liv-in-sky

                                    hmip.0.devices.3014F711A00000D709954F99.channels.0.lowBat
                                    hmip.0.devices.3014F711A00000D709955FBB.channels.0.lowBat
                                    usw.

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

                                      @alexmuc81

                                      der stern steht in diesem selector für mehr als nur devices - es sollte also funktionieren

                                      ob ich

                                      hmip.0...channels.0.lowBat

                                      oder

                                      hmip.0.*.channels.0.lowBat

                                      oder

                                      hmip.0.*.0.lowBat

                                      schreibe , es wird immer der lowBat gefunden - ein stern kann vieles beinhalten

                                      wenn der name des gerätes in der tabelle angezeigt ist, ist alles ok vom script her - dann kommt es darauf an was der dp anzeigt - wenn lowBat=true sollte eine warnung angezeigt sein, bei lowBat=false nicht - was zeigt der dp an ?

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

                                        @liv-in-sky

                                        lowBat=true

                                        lowBat.JPG

                                        Ich hab mir in der Console gerade mal val1help ausgeben lassen. Da stehen ja die
                                        Werte drin:

                                        javascript.0 2022-03-13 23:00:37.026	info	script.js.akkutabelle: true
                                        

                                        Zweiter Test war dann die Zeile mit einem Console.log auszustatten

                                        if (val1help=="true") {console.log("Test");val1=(" <font color=\"red\"> ")+"low bat"; json2="low";json5="red";json3_1=0} else{console.log("Test2");val1=(" <font color=\"lightgreen\"> ")+"full bat";json2="high";json5="green";json3_1=100} 
                                        
                                        

                                        Das wiederum brachte:

                                        
                                        javascript.0 2022-03-13 23:03:42.247	info	script.js.akkutabelle: Test2
                                        
                                        javascript.0 2022-03-13 23:03:42.247	info	script.js.akkutabelle: false
                                        
                                        javascript.0 2022-03-13 23:03:42.247	info	script.js.akkutabelle: Test2
                                        
                                        javascript.0 2022-03-13 23:03:42.246	info	script.js.akkutabelle: true
                                        
                                        javascript.0 2022-03-13 23:03:42.246	info	script.js.akkutabelle: Test2
                                        
                                        javascript.0 2022-03-13 23:03:42.246	info	script.js.akkutabelle: false
                                        

                                        Also irgendwie funktioniert val1help=="true" nicht.....

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

                                          @alexmuc81 mache mal alle anführungszeichen um das true weg - was passiert dann ?

                                           if (val1help==true) {val1=(" <font color=\"red\"> ")+"low bat"; json2="low";json5="red";json3_1=0} else{val1=(" <font color=\"lightgreen\"> ")+"full bat";json2="high";json5="green";json3_1=100} 
                                                         if (val1help==true) {val2=symbolKO;json3=symbolKO} else{val2=symbolOK;json3=symbolKO}         
                                                         if (val1help==true) AkkuAlarm.push(1);
                                                         if (val1help==true)  alarmMessage.push(val0);
                                          
                                          A 1 Reply Last reply Reply Quote 0
                                          • A
                                            AlexMuc81 @liv-in-sky last edited by

                                            @liv-in-sky

                                             if (val1help) {val1=(" <font color=\"red\"> ")+"low bat"; json2="low";json5="red";json3_1=0} else{val1=(" <font color=\"lightgreen\"> ")+"full bat";json2="high";json5="green";json3_1=100} 
                                            if (val1help) {val2=symbolKO;json3=symbolKO} else{val2=symbolOK;json3=symbolKO}         
                                            if (val1help) AkkuAlarm.push(1);
                                            if (val1help)  alarmMessage.push(val0);
                                            

                                            ich habe es auf die gleiche abfrage wie in der Schleife davor geändert und schon
                                            funktioniert es. Danke für den Tip. Keine Ahnung warum ich darauf nicht selbst gekommen bin...

                                            liv-in-sky 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            854
                                            Online

                                            31.9k
                                            Users

                                            80.1k
                                            Topics

                                            1.3m
                                            Posts

                                            javascript monitoring template
                                            67
                                            1379
                                            415434
                                            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