Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Visualisierung
    4. Lastfluss, Energie animierte Gif

    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

    Lastfluss, Energie animierte Gif

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

      @liv-in-sky
      ah, super - über den ersten Link mit dem gradient Angaben in Prozent lässt es sich nicht darstellen. Zumindest komme ich nach kurzem Nachdenken nicht drauf. Wenn du bei deinem 2. Link was findest - wäre spitze. Ich schau mir das auch an.

      Alternativ schau ich mir mal an, ob ich noch die Form etwas anders darstellen kann. Dann könnte es auch mit den Prozentangaben klappen...

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

        @mguenther

        evtl mit dieser seite: http://thenewcode.com/1155/Understanding-Linear-SVG-Gradients gleich das bild mit dem blau gelb - wenn man das irgendwie hindreht - und einen extra pfad für die untere linie macht - werd heute nicht mehr viel zeit haben - eher nächste woche mal

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

          @liv-in-sky
          danke dir - aber das ist doch der gleiche Ansatz - oder?

          A diagonal gradient will therefore be created by setting y2 to a value of 100%:
          
          <linearGradient id="testbed4" y2="100%">
              <stop stop-color="yellow" offset="0" />
              <stop stop-color="blue" offset="0.5" />
              <stop stop-color="black" offset="1" />
          </linearGradient>
          Note that this does not create a 45° gradient, as the values are relative to the dimensions of the element
          
          1 Reply Last reply Reply Quote 0
          • liv-in-sky
            liv-in-sky @mguenther last edited by liv-in-sky

            @mguenther

            was ist damit

            script-vis25.gif

            besser bekomm ich es im moment nicht hin

            <svg width="100%" height="100%" >
            		
            	<defs>
                <linearGradient id="MyGradientFull1" x1="0%" y1="83%" x2="100%" y2="17%">
                     <stop offset="35%" style="stop-color:rgb(255,0,14);stop-opacity:1.00" />
                      <stop offset="45%" style="stop-color:rgb(130,195,238);stop-opacity:1.00" />
                      <stop offset="50%" style="stop-color:rgb(40,118,166);stop-opacity:1.00" />
                      <stop offset="60%" style="stop-color:rgb(7,41,219);stop-opacity:1.00" />
            
                </linearGradient>
              </defs>
                   
                 <g transform="scale(1)" >
            	 
            	 
                    <g  >
            		
            
            	
            	<path class="loadingFull" d="M380,215 L180 215
                        " fill= "none" stroke-width="8" stroke-dasharray="15 5" stroke="red"></path>
            	                                      
                     <path  class="loadingFull1" d="M 180 215
            
            L 10 15 
            A 2.0 1 0 1 1 25 10
            L 200 180
            A 2.0 1 0 0 0 260 170
            L 50 15
            A 2.0 1 0 1 1 70 10
            L 365 200
            L380 200
            										
                                                    "
            	         fill= "none" stroke-width="8" stroke-dasharray="15 5" 	
                         stroke="url(#MyGradientFull1)"								 
                                                    />
                               
                          
                        /> 
                                                  
                    </g>
                    
                    <g>
                      
              
            									  
            										  
            										  
                  
                </g>   
                </g> </svg>
            
            		<style>
            		
            		.loadingFull1 {
            	 animation: strokeFull1 .7s infinite linear;
                 }
            
            @keyframes strokeFull1 {
            	0% {
            		stroke-dashoffset: -40;
            	}
            	100% {
            		stroke-dashoffset: 0;
            	}
                }
               </style>	
            		
            				
            ```
            [/s]
            M 2 Replies Last reply Reply Quote 0
            • M
              mguenther @liv-in-sky last edited by mguenther

              @liv-in-sky

              sieht spitze aus. Schaue ich mir an.

              Ich habe es eben noch mit
              https://www.mediaevent.de/tutorial/svg-gradient.html#:~:text=SVG linearGradient – Farbverlauf,ohne sichtbare Grenzen ineinander verlaufen
              ausprobiert - geht im Prinzip über die Prozentwerte, allerdings dann eben um eine Rotation um den Mittelpunkt.

              Entweder darüber:

              <linearGradient id="rotate1" href="#diagonal" gradientTransform="rotate(66)" />
              

              oder

              Um einen SVG-Gradient um sein Zentrum zu rotieren, müssen die Werte für x1, y1, x2 und y2 berechnet werden: Back to school und Sinus und Cosinus hervorkramen (bei 133°).
              
              let pi = 133 * (Math.PI / 180);
              let x1 = Math.round(50 + Math.sin(pi) * 50) / 100;           //0.87
              let y1 = Math.round(50 + Math.cos(pi) * 50) / 100;           //0.16
              let x2 = Math.round(50 + Math.sin(pi + Math.PI) * 50) / 100; //0.13
              let y2 = Math.round(50 + Math.cos(pi + Math.PI) * 50) / 100; //0.84
              

              habs aber noch nicht gut hinbekommen

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

                @liv-in-sky

                danke dir - es passt jetzt mit deiner Hilfe
                090e41ae-a87d-4724-adba-ab99ef291c95-image.png
                In den Übergängen passt es noch nicht ganz - aber ist mir egal 🙂

                <svg width="380" height="220" >
                	<defs>
                		<linearGradient id='MyGradient1011' x1="0.87" y1=0.16" x2=".13" y2=".84">
                			<stop offset='0%' stop-color=#dd1c00 />
                			<stop offset='100%' stop-color=#007fff />
                		</linearGradient>
                
                		<linearGradient id="MyGradientFull1" x1="0%" y1="83%" x2="100%" y2="17%">
                		<stop offset="35%" style="stop-color:#dd1c00;stop-opacity:1.00" />
                		<stop offset="45%" style="stop-color:#874263;stop-opacity:1.00" />
                		<stop offset="50%" style="stop-color:#4c5da7;stop-opacity:1.00" />
                		<stop offset="60%" style="stop-color:#007fff;stop-opacity:1.00" />
                 	</linearGradient>
                
                	</defs>
                
                
                	<g transform="scale(1)" style="stroke:url(#MyGradientFull1)" >
                        	<path class="loadingFull" d="
                
                M 170 215
                L 10 100 
                A 1.5 .65 0 1 1 30 95
                L 195 180
                A 1.5 .4 0 0 0 240 170
                L 88 100
                A 1.5 .65 0 1 1 110 95
                L 365 180
                L380 180
                "/>
                	</g>
                        
                </svg>
                   	
                <style>
                .loadingFull {
                	fill: none;
                	border-radius: 50%;
                	stroke-width: 6;
                	stroke-dasharray: 15 3;
                	animation: strokeAni 2s infinite linear;
                }
                 
                @keyframes strokeAni {
                	0% {
                		stroke-dashoffset: -40;
                	}
                	100% {
                		stroke-dashoffset: 0;
                   	}
                }
                
                </style>
                
                1 Reply Last reply Reply Quote 0
                • N
                  nerg last edited by

                  Ich habe mit eurer Vorarbeit und mit Hilfe von Chatgpt auch mal gearbeitet und bin sehr gut ans Ziel gekommen. Wollte nur mal Danke sagen 😉

                  Hier einfach mal 2 Linien. Ich bau mir nun ein schönes Skript für den Rest, das mir die Geschwindigkeit hoch und runter baut usw 😉

                  <svg width="99%" height="99%">
                    <defs>
                      <linearGradient id="gradient1" x1="0%" y1="0%" x2="100%" y2="0%">
                        <stop offset="0%" style="stop-color: red;" />
                        <stop offset="100%" style="stop-color: yellow;" />
                      </linearGradient>
                    </defs>
                    <path class="loading0" 
                      d="
                      M5 5
                      L200 5
                      A15 15 0 0 1 215 20
                      L215 90
                      " 
                      fill="none" stroke="url(#gradient1)" stroke-width="5" stroke-dasharray="15 5" />
                  </svg>
                  
                  <svg width="99%" height="99%">
                    <defs>
                      <linearGradient id="gradient2" x1="0%" y1="0%" x2="100%" y2="0%">
                        <stop offset="0%" style="stop-color: darkgreen;" />
                        <stop offset="100%" style="stop-color: lightgreen;" />
                      </linearGradient>
                    </defs>
                    <path class="loading1" 
                      d="
                      M5 305
                      L200 305
                      A15 15 0 0 1 215 320
                      L215 390
                      " 
                      fill="none" stroke="url(#gradient2)" stroke-width="5" stroke-dasharray="15 5" />
                  </svg>
                  
                  <style>
                    .loading0 {
                      stroke-dashoffset: 20;
                      animation: strokeAni0 0.5s infinite linear;
                    }
                    
                    .loading1 {
                      stroke-dashoffset: 40;
                      animation: strokeAni1 3s infinite linear;
                    }
                    
                    @keyframes strokeAni0 {
                      0% {
                        stroke-dashoffset: 20;
                      }
                      100% {
                        stroke-dashoffset: 0;
                      }
                    }
                    
                    @keyframes strokeAni1 {
                      0% {
                        stroke-dashoffset: 40;
                      }
                      100% {
                        stroke-dashoffset: 0;
                      }
                    }
                  </style>
                  
                  
                  1 Reply Last reply Reply Quote 0
                  • N
                    nerg last edited by nerg

                    Hier noch das Skript, falls jemand über den thread stolpert. Durch den Aufruf alle 10 Sekunden gibt es in der Animation alle 10 Sekunden einen "Ruckler"

                    // Datenpunkt prüfen und erstellen
                    function pruefeUndErstelleDatenpunkt(datenpunkt) {
                      if (!existsState(datenpunkt)) {
                        createState(datenpunkt, {
                          name: "PV Ertrag",
                          type: "string",
                          role: "text",
                          read: true,
                          write: false
                        });
                      }
                    }
                    
                    // Start des Skripts
                    const ertragDatenpunkt = 'modbus.0.holdingRegisters.40068_PV_Leistung';
                    const ausgabedatenpunkt = '0_userdata.0.vis.pv.pvErtrag';
                    
                    pruefeUndErstelleDatenpunkt(ausgabedatenpunkt);
                    
                    // Funktion zum Erstellen des Pfads
                    function erstellePfad(ertrag) {
                      const pfad = `M5 5 L200 5 A15 15 0 0 1 215 20 L215 90`;
                    
                      // Farbverlauf und Animationseigenschaften basierend auf dem Ertrag
                      let farbverlauf, animationsKlasse, animationsDauer, animationFillMode;
                      if (ertrag < 0) {
                        farbverlauf = "url(#pv-gradient1)";
                        animationsKlasse = "pv-animation";
                        animationsDauer = `${(3 - (3 * ertrag / 6000)).toFixed(2)}s`;
                        animationFillMode = "both";
                      } else if (ertrag === 0) {
                        farbverlauf = "black";
                        animationsKlasse = "";
                        animationsDauer = "0s";
                        animationFillMode = "";
                      } else if (ertrag > 0) {
                        farbverlauf = "url(#pv-gradient2)";
                        animationsKlasse = "pv-animation";
                        animationsDauer = `${(3 - (3 * ertrag / 9000)).toFixed(2)}s`;
                        animationFillMode = "both";
                      } else {
                        farbverlauf = "none";
                        animationsKlasse = "";
                        animationsDauer = "";
                        animationFillMode = "";
                      }
                    
                      // Pfad erstellen
                      const pfadElement = `<path class="${animationsKlasse}" d="${pfad}" fill="none" stroke="${farbverlauf}" stroke-width="5" stroke-dasharray="15 5"></path>`;
                      const styleCode = `<style>.pv-animation { stroke-dashoffset: 20; animation: pv-animation-ani ${animationsDauer} infinite linear ${animationFillMode}; } @keyframes pv-animation-ani { 0% { stroke-dashoffset: 20; } 100% { stroke-dashoffset: 0; } }</style>`;
                      const svgHTML = `<svg width="99%" height="99%"><defs><linearGradient id="pv-gradient1" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%" style="stop-color: red;" /><stop offset="100%" style="stop-color: yellow;" /></linearGradient><linearGradient id="pv-gradient2" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%" style="stop-color: darkgreen;" /><stop offset="100%" style="stop-color: lightgreen;" /></linearGradient>${styleCode}</defs>${pfadElement}</svg>`;
                    
                      return svgHTML;
                    }
                    
                    schedule("*/10 * * * * *", async function () {
                      const ertrag = getState(ertragDatenpunkt).val;
                      const pfadHTML = erstellePfad(ertrag);
                      setState(ausgabedatenpunkt, pfadHTML);
                    });
                    
                    

                    Wenn ihr Pfade bauen wollt und wie ich keinen Schimmer habt , dann lege ich euch dringend den Chatbot eures Vertrauens ans Herzen. War super einfach so.

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

                      @liv-in-sky

                      Ich hab mich hier mal rangehängt, da ich auch gerade versucht, den Stromfluss in iobroker abzubilden.
                      Ich habe dazu eine recht einfache svg-Linie hier aus dem Thread übernommen und ihn in meine Seite eingebaut - im Editor sieht das auch gut aus (= Linie ist animiert), aber wenn ich das Ganze dann aber in der Runtime anschaue, ist die Animation gestoppt, da wird die Linie komplett statisch dargestellt und ich weiß nicht warum.

                      Es hat ein wenig gedauert, bis ich zu Großteilen verstanden habe, wie das mit der svg-Linie funktioniert und welche Werte welchen Einfluss haben... letztlich habe ich auf meiner Seite 5 Linien. In einer der Linien habe ich die vollständige Definition (incl. Farben, Geschwindigkeit etc) und in allen anderen nur die Linie + den class path, der das Aussehen steuert.

                      Das ist nur in "einer" der Linien hinterlegt

                      <svg width="40" height="100">
                          <path class="stromOff"
                          d = "M 5 5 L 5 95"
                          />
                      </svg>
                      
                      <style>
                      .stromOn {
                          fill: none;
                          stroke: green;
                          border-radius: 50%;
                          stroke-width: 5;
                          stroke-dasharray: 5 5;
                          animation: strokeAni 1.2s infinite linear;
                      }
                      
                      .stromOff {
                          fill: none;
                          stroke: lightgrey;
                          border-radius: 50%;
                          stroke-width: 5;
                          stroke-dasharray: 15 5;
                          animation: strokeAni 0s infinite linear;
                      }
                      
                      
                      .inner {
                          stroke: #c32e04;
                          animation-direction: reverse;
                      }
                      
                      @keyframes strokeAni {
                          0% {stroke-dashoffset: 40;}
                          100% {stroke-dashoffset: 0;}
                      }
                      </style>
                      

                      und das ist (mit anderen Formen) in den anderen 4 Linien angegeben:

                      <svg width="160" height="150">
                      <path class="stromOn"
                            d="
                          M 5 140
                          L 140 140
                          L 140 5"  />
                      </svg>
                      

                      Hat jemand hier eine Lösung, wie die Linie auch ausserhalb des editors animiert dargestellt wird?
                      btw: das ist schon der zweite Fall, bei dem die Darstellung im Editor mit der in der Runtime abweicht, beim vis-inventwo JSON ist mir ein ähnliche Situation begegnet.

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

                        @maddm

                        probiermal:

                        <style>
                        .stromOn {
                            fill: none;
                            stroke: green;
                            border-radius: 50%;
                            stroke-width: 5;
                            stroke-dasharray: 5 5;
                            animation: strokeAni11 1.2s infinite linear;
                        }
                         
                        .stromOff {
                            fill: none;
                            stroke: lightgrey;
                            border-radius: 50%;
                            stroke-width: 5;
                            stroke-dasharray: 15 5;
                            animation: strokeAni11 0.7s infinite linear;
                        }
                         
                         
                        .inner {
                            stroke: #c32e04;
                            animation-direction: reverse;
                        }
                         
                        @keyframes strokeAni11 {
                        	0% {
                        		stroke-dashoffset: -40;
                        	}
                        	100% {
                        		stroke-dashoffset: 0;
                        	}
                        }
                        </style>
                        
                        <svg width="40" height="100">
                            <path class="stromOff"
                            d = "M 5 5 L 5 95"
                            />
                        </svg>
                         
                        
                        
                        
                        
                        
                        
                        
                        1 Reply Last reply Reply Quote 0
                        • H
                          hugo1217 @liv-in-sky last edited by

                          @liv-in-sky

                          hier bin ich. wie bindet man denn Datenpunkt ein??

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

                            @hugo1217

                            meinst du sowas : https://forum.iobroker.net/post/807124

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

                              @liv-in-sky ja

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

                                @hugo1217

                                ich habe immer noch nicht verstanden, was genau du machen willst - kannst du mit dem post was anfangen

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

                                  @liv-in-sky
                                  ok 😉
                                  habe deine Lastfluss soweit in meine Vis eingefügt. Jetzt möchte soll dieser nur angezeigt werden bzw. fliessen wenn was passiert. Also zum bsp. Ertrag der Solaranlage soll dann der Lastfluss in die Batterie angezeigt werden. Nachts soll dieser dann aber nicht angezeigt werden da ja kein Ertrag da ist.

                                  Gruß

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

                                    @hugo1217

                                    also das ganze widget soll ausgeblendet werden ? der lastfluss unsichtbar

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

                                      @hugo1217

                                      das kann jedes widget unter den eigenschaften "Sichtbarkeit"- dort kann ein dp angegeben werden, der das widget unstichbar macht

                                      den adapter für lastfluss hast du schon getestet ?

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

                                        @liv-in-sky

                                        ja den adapter habe ich mir angeschaut. Finde ich nicht so toll.

                                        icebear 1 Reply Last reply Reply Quote 0
                                        • icebear
                                          icebear @hugo1217 last edited by

                                          @hugo1217

                                          Warum nimmst du nicht den 'Energiefluss-Erweitert'- Adapter, dsa kannst du doch alles einstellen und animieren wie du es brauchst?

                                          Ich hatte am Anfang auch alles mit animierten GIF gemacht, und hab dann alles weggeschmissen weil der Energiefluss-Erweitert Adapter das alles super darstellen kann.

                                          Lässt sich dann auch Problemlos in die VIS integrieren.

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

                                            @liv-in-sky Super, danke für Deine tolle Arbeit! Ich habe das Problem, dass ich gleichzeitig zwei weitere Farben für Pfeile benötige. Wo kann ich das einstellen?

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            516
                                            Online

                                            31.9k
                                            Users

                                            80.1k
                                            Topics

                                            1.3m
                                            Posts

                                            template vis
                                            15
                                            69
                                            12030
                                            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