Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Visualisierung
    4. HTLM Widget mit variablem Attribute

    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

    HTLM Widget mit variablem Attribute

    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      StarLord42 last edited by

      Guten Morgen,

      ich möchte ein HTML Widget verwenden, um die Temperatur eines Raumes anzuzeigen.
      Hierfür stelle ich mir eine svg Polyline Kontur vor, die gefüllt wird.
      Mit einem statischen Wert für das Attribut fill funktioniert es:

      <svg with="240" height="100">
        <polyline points="0,0 240,0 240,100 100,100 100,80 0,80" fill="#f36905"/>
      </svg>
      

      Wie kann ich das Attribut dynamisch füllen lassen, also in Abhängigkeit von dem Wert eines Datenpunktes.
      Ich habe folgendes versucht, leider ohne Erfolg.

      <svg with="240" height="100">
        <polyline points="0,0 240,0 240,100 100,100 100,80 0,80"
        fill="{v:0_userdata.0.Heizung.OG_Badezimmer.TempCur;v > 25 ? &quot;#f36905&quot; : v > 24.5 ? &quot;#f37506&quot; : &quot;#419f7c&quot;}"/>
      </svg>
      

      Gruß Andreas

      Homoran ice987 2 Replies Last reply Reply Quote 0
      • Homoran
        Homoran Global Moderator Administrators @StarLord42 last edited by

        @starlord42 nicht dass ich javascript kann, aber fehlt da nicht ein .val ?

        S 1 Reply Last reply Reply Quote 0
        • S
          StarLord42 @Homoran last edited by

          @homoran Das ist kein JS.

          Ich denke ich werde als Workaround die Farbe über ein Skript steuern.
          Der folgende Ansatz funktioniert:

          <svg with="240" height="100">
            <polyline points="0,0 240,0 240,100 100,100 100,80 0,80"
            fill='{0_userdata.0.FillColor}'/>
          </svg>
          
          1 Reply Last reply Reply Quote 0
          • ice987
            ice987 @StarLord42 last edited by

            @starlord42

            z.B.:

            <svg with="240" height="100">
              <polyline points="0,0 240,0 240,100 100,100 100,80 0,80"
              fill="{v:0_userdata.0.test.test41;v > 25 ? '#ff000' :: (v > 20 ? '#fff000' :: '#00ff00')}"/>
            </svg>
            

            wenn DP type: number

            S 1 Reply Last reply Reply Quote 0
            • S
              StarLord42 @ice987 last edited by

              @ice987
              Sorry, dass ich mich nicht zurückgemeldet habe. Irgendwie habe ich Deine Nachricht übersehen.
              Inzwischen habe ich alles auf umgebaut, aber trotzdem danke.

              DJMarc75 1 Reply Last reply Reply Quote 0
              • DJMarc75
                DJMarc75 @StarLord42 last edited by

                @starlord42 sagte in HTLM Widget mit variablem Attribute:

                Inzwischen habe ich alles auf umgebaut, aber trotzdem danke.

                auf "was" genau ? 😉

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

                Support us

                ioBroker
                Community Adapters
                Donate

                426
                Online

                31.9k
                Users

                80.1k
                Topics

                1.3m
                Posts

                4
                6
                246
                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