Skip to content
  • Home
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Blockly
  5. JS-Funktion mit Ergebnis - Hexadezimal zu Dezimal

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    14
    1
    190

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    12
    1
    572

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    24
    1
    1.8k

JS-Funktion mit Ergebnis - Hexadezimal zu Dezimal

Geplant Angeheftet Gesperrt Verschoben Blockly
18 Beiträge 4 Kommentatoren 1.3k Aufrufe 4 Watching
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • A Andre3000

    @paul53 Danke nochmal!

    Weiterhin der selbe Fehler.

    <xml xmlns="https://developers.google.com/blockly/xml">
      <variables>
        <variable id="@wly!s9.=$P|eqoW(37w">hex</variable>
      </variables>
      <block type="procedures_defcustomreturn" id="E+7ql{WXKc5p$fl8Y~5m" x="-338" y="-862">
        <mutation statements="false">
          <arg name="hex" varid="@wly!s9.=$P|eqoW(37w"></arg>
        </mutation>
        <field name="NAME">hex2dec</field>
        <field name="SCRIPT">cmV0dXJuIHBhcnNlSW50KGhleCwgMTYpOw==</field>
        <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
      </block>
      <block type="on_ext" id="DJak+8K8`e`}DGm`i,y3" x="-325" y="-827">
        <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
        <field name="CONDITION">ne</field>
        <field name="ACK_CONDITION"></field>
        <value name="OID0">
          <shadow type="field_oid" id="K!47v4.fLS*+lYC=27C5">
            <field name="oid">0_userdata.0.Input_HEX</field>
          </shadow>
        </value>
        <statement name="STATEMENT">
          <block type="control" id="smq1BY-E%^xo]/BG_*w)">
            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
            <field name="OID">homee.0.DimmableRGBWLight-81.Color-615</field>
            <field name="WITH_DELAY">FALSE</field>
            <value name="VALUE">
              <block type="procedures_callcustomreturn" id="N;r^{^6UA!u^z9Z)yx:B">
                <mutation name="hex2dec">
                  <arg name="hex"></arg>
                </mutation>
                <value name="ARG0">
                  <block type="on_source" id="PVFc5Tw;otlg~9ix;ilc">
                    <field name="ATTR">state.val</field>
                  </block>
                </value>
              </block>
            </value>
          </block>
        </statement>
      </block>
    </xml>
    

    @apollon77 Eventuell möchtest du mal einen Blick drauf werfen, da das ursprüngliche "Problem" darin liegt, dass der Homee Adapter den Farbwert Dezimal in Objekte schreibt, aber die meisten Color Picker eher mit HEX Werten rechnen. Ich habe dazu auf github ein Issue gefunden, dass bereits vor vielen Jahren geclosed wurde. Hat sich der selbe "Fehler" wieder eingeschlichen oder ist das mittlerweile gewollt, dass die Werte in Dezimal geliefert werden?

    Beste Grüße
    André

    apollon77A Offline
    apollon77A Offline
    apollon77
    schrieb am zuletzt editiert von
    #8

    @andre3000 ALso das sollte im Adapter drin sein. Dann bitteneues Issue anlegen, vollstädiges Debug log dran packen und sagen woes genau falsch ist. muss ich schauen

    Beitrag hat geholfen? Votet rechts unten im Beitrag :-) https://paypal.me/Apollon77 / https://github.com/sponsors/Apollon77

    • Debug-Log für Instanz einschalten? Admin -> Instanzen -> Expertenmodus -> Instanz aufklappen - Loglevel ändern
    • Logfiles auf Platte /opt/iobroker/log/… nutzen, Admin schneidet Zeilen ab
    1 Antwort Letzte Antwort
    1
    • A Andre3000

      @paul53 Es wird sicher nur ne Kleinigkeit sein. Ist mein erstes blockly an dem ich mich versuche.

      {
        "common": {
          "name": "Input_HEX",
          "desc": "Manuell erzeugt",
          "role": "state",
          "type": "string",
          "read": true,
          "write": true,
          "def": 0
        },
        "type": "state",
        "native": {},
        "_id": "0_userdata.0.Input_HEX",
        "from": "system.adapter.admin.0",
        "user": "system.user.admin",
        "ts": 1670937135908
      }
      
      paul53P Offline
      paul53P Offline
      paul53
      schrieb am zuletzt editiert von paul53
      #9

      @andre3000
      Ich meine nicht das Objekt, sondern den Wert.

      Bild_2022-12-13_141623924.png

      Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
      Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

      A 1 Antwort Letzte Antwort
      0
      • paul53P paul53

        @andre3000
        Ich meine nicht das Objekt, sondern den Wert.

        Bild_2022-12-13_141623924.png

        A Offline
        A Offline
        Andre3000
        schrieb am zuletzt editiert von
        #10

        @paul53 ein Hexadezimaler Farbwert z.B. "#0800ff"
        So wird es jetzt auch im Log angezeigt

        14:17:43.685	info	javascript.0 (11911) script.js.common.hextodec: #5d54ff
        
        paul53P 1 Antwort Letzte Antwort
        0
        • A Andre3000

          @paul53 ein Hexadezimaler Farbwert z.B. "#0800ff"
          So wird es jetzt auch im Log angezeigt

          14:17:43.685	info	javascript.0 (11911) script.js.common.hextodec: #5d54ff
          
          paul53P Offline
          paul53P Offline
          paul53
          schrieb am zuletzt editiert von
          #11

          @andre3000 sagte: "#0800ff"

          Das "#" ist zu viel.

          Bild_2022-12-13_142103341.png

          Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
          Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

          A 1 Antwort Letzte Antwort
          1
          • paul53P paul53

            @andre3000 sagte: "#0800ff"

            Das "#" ist zu viel.

            Bild_2022-12-13_142103341.png

            A Offline
            A Offline
            Andre3000
            schrieb am zuletzt editiert von Andre3000
            #12

            @paul53 Wir kommen der Sache näher!

            javascript.0 (11911) script.js.common.hextodec: ff4124  
            

            Umrechung in Dezimal Funktioniert auch!

            	javascript.0 (11911) script.js.common.hextodec: 1852159
            

            Allerdings weiterhin:

            	2022-12-13 14:28:39.069	error	homee connection error: "value must be a number"
            
            paul53P 1 Antwort Letzte Antwort
            0
            • A Andre3000

              @paul53 Wir kommen der Sache näher!

              javascript.0 (11911) script.js.common.hextodec: ff4124  
              

              Umrechung in Dezimal Funktioniert auch!

              	javascript.0 (11911) script.js.common.hextodec: 1852159
              

              Allerdings weiterhin:

              	2022-12-13 14:28:39.069	error	homee connection error: "value must be a number"
              
              paul53P Offline
              paul53P Offline
              paul53
              schrieb am zuletzt editiert von paul53
              #13

              @andre3000 sagte: Allerdings weiterhin:

              ?? Das gezeigte Blockly muss funktionieren, denn es wird eine Zahl geschrieben.

              Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
              Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

              A 1 Antwort Letzte Antwort
              0
              • paul53P paul53

                @andre3000 sagte: Allerdings weiterhin:

                ?? Das gezeigte Blockly muss funktionieren, denn es wird eine Zahl geschrieben.

                A Offline
                A Offline
                Andre3000
                schrieb am zuletzt editiert von
                #14

                @paul53 Die Umrechnung funktioniert jetzt auch wunderbar! Vielen Dank erstmal dafür

                14:38:50.564	info	javascript.0 (11911) script.js.common.hextodec: 19ff0d
                14:38:50.565	info	javascript.0 (11911) script.js.common.hextodec: 1703693
                

                Jetzt muss dieser Wert nur noch irgendwie in mein RGB Objekt geschrieben werden.

                paul53P 1 Antwort Letzte Antwort
                0
                • A Andre3000

                  @paul53 Die Umrechnung funktioniert jetzt auch wunderbar! Vielen Dank erstmal dafür

                  14:38:50.564	info	javascript.0 (11911) script.js.common.hextodec: 19ff0d
                  14:38:50.565	info	javascript.0 (11911) script.js.common.hextodec: 1703693
                  

                  Jetzt muss dieser Wert nur noch irgendwie in mein RGB Objekt geschrieben werden.

                  paul53P Offline
                  paul53P Offline
                  paul53
                  schrieb am zuletzt editiert von
                  #15

                  @andre3000 sagte: Jetzt muss dieser Wert nur noch irgendwie in mein RGB Objekt geschrieben werden.

                  Zeige mal das aktuelle Blockly.

                  Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
                  Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

                  A 1 Antwort Letzte Antwort
                  0
                  • paul53P paul53

                    @andre3000 sagte: Jetzt muss dieser Wert nur noch irgendwie in mein RGB Objekt geschrieben werden.

                    Zeige mal das aktuelle Blockly.

                    A Offline
                    A Offline
                    Andre3000
                    schrieb am zuletzt editiert von
                    #16

                    @paul53 Bildschirmfoto 2022-12-13 um 15.12.57.png

                    <xml xmlns="https://developers.google.com/blockly/xml">
                     <variables>
                       <variable id="@wly!s9.=$P|eqoW(37w">hex</variable>
                     </variables>
                     <block type="procedures_defcustomreturn" id="E+7ql{WXKc5p$fl8Y~5m" x="-338" y="-862">
                       <mutation statements="false">
                         <arg name="hex" varid="@wly!s9.=$P|eqoW(37w"></arg>
                       </mutation>
                       <field name="NAME">hex2dec</field>
                       <field name="SCRIPT">cmV0dXJuIHBhcnNlSW50KGhleCwgMTYpOw==</field>
                       <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                     </block>
                     <block type="on_ext" id="DJak+8K8`e`}DGm`i,y3" x="-325" y="-827">
                       <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                       <field name="CONDITION">ne</field>
                       <field name="ACK_CONDITION"></field>
                       <value name="OID0">
                         <shadow type="field_oid" id="K!47v4.fLS*+lYC=27C5">
                           <field name="oid">0_userdata.0.Input_HEX</field>
                         </shadow>
                       </value>
                       <statement name="STATEMENT">
                         <block type="variables_set" id="~VQ$kSov,Z*_gF[+@u4B">
                           <field name="VAR" id="@wly!s9.=$P|eqoW(37w">hex</field>
                           <value name="VALUE">
                             <block type="text_getSubstring" id="qpcNcW=(fu~!`OS+{2]x">
                               <mutation at1="true" at2="false"></mutation>
                               <field name="WHERE1">FROM_START</field>
                               <field name="WHERE2">LAST</field>
                               <value name="STRING">
                                 <block type="on_source" id="N}S}nXTKY+pt*D5M|m{r">
                                   <field name="ATTR">state.val</field>
                                 </block>
                               </value>
                               <value name="AT1">
                                 <block type="math_number" id="kKPtslp=Q]_j3}g,)_=K">
                                   <field name="NUM">2</field>
                                 </block>
                               </value>
                             </block>
                           </value>
                           <next>
                             <block type="control" id="smq1BY-E%^xo]/BG_*w)">
                               <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                               <field name="OID">homee.0.DimmableRGBWLight-81.Color-615</field>
                               <field name="WITH_DELAY">FALSE</field>
                               <value name="VALUE">
                                 <block type="procedures_callcustomreturn" id="N;r^{^6UA!u^z9Z)yx:B">
                                   <mutation name="hex2dec">
                                     <arg name="hex"></arg>
                                   </mutation>
                                   <value name="ARG0">
                                     <block type="on_source" id="PVFc5Tw;otlg~9ix;ilc">
                                       <field name="ATTR">state.val</field>
                                     </block>
                                   </value>
                                 </block>
                               </value>
                               <next>
                                 <block type="debug" id="TDS|)8v`Nvfg`8BdE;g}">
                                   <field name="Severity">log</field>
                                   <value name="TEXT">
                                     <shadow type="text" id="CE}CfbUYY,$p?AK9nlEF">
                                       <field name="TEXT">test</field>
                                     </shadow>
                                     <block type="variables_get" id="vURGF1P.rOr,)NPQ7{0M">
                                       <field name="VAR" id="@wly!s9.=$P|eqoW(37w">hex</field>
                                     </block>
                                   </value>
                                   <next>
                                     <block type="debug" id="Ei8A@Yey5*nGcLY(L8tv">
                                       <field name="Severity">log</field>
                                       <value name="TEXT">
                                         <shadow type="text" id=")qSg]71+,+z|]El1R^R3">
                                           <field name="TEXT">test</field>
                                         </shadow>
                                         <block type="procedures_callcustomreturn" id="iBBRl,O]@E~sqpA8,I;t">
                                           <mutation name="hex2dec">
                                             <arg name="hex"></arg>
                                           </mutation>
                                           <value name="ARG0">
                                             <block type="variables_get" id="$#D7f47}*EK:YjcIHz*9">
                                               <field name="VAR" id="@wly!s9.=$P|eqoW(37w">hex</field>
                                             </block>
                                           </value>
                                         </block>
                                       </value>
                                     </block>
                                   </next>
                                 </block>
                               </next>
                             </block>
                           </next>
                         </block>
                       </statement>
                     </block>
                    </xml>
                    

                    DJMarc75D 1 Antwort Letzte Antwort
                    0
                    • A Andre3000

                      @paul53 Bildschirmfoto 2022-12-13 um 15.12.57.png

                      <xml xmlns="https://developers.google.com/blockly/xml">
                       <variables>
                         <variable id="@wly!s9.=$P|eqoW(37w">hex</variable>
                       </variables>
                       <block type="procedures_defcustomreturn" id="E+7ql{WXKc5p$fl8Y~5m" x="-338" y="-862">
                         <mutation statements="false">
                           <arg name="hex" varid="@wly!s9.=$P|eqoW(37w"></arg>
                         </mutation>
                         <field name="NAME">hex2dec</field>
                         <field name="SCRIPT">cmV0dXJuIHBhcnNlSW50KGhleCwgMTYpOw==</field>
                         <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                       </block>
                       <block type="on_ext" id="DJak+8K8`e`}DGm`i,y3" x="-325" y="-827">
                         <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                         <field name="CONDITION">ne</field>
                         <field name="ACK_CONDITION"></field>
                         <value name="OID0">
                           <shadow type="field_oid" id="K!47v4.fLS*+lYC=27C5">
                             <field name="oid">0_userdata.0.Input_HEX</field>
                           </shadow>
                         </value>
                         <statement name="STATEMENT">
                           <block type="variables_set" id="~VQ$kSov,Z*_gF[+@u4B">
                             <field name="VAR" id="@wly!s9.=$P|eqoW(37w">hex</field>
                             <value name="VALUE">
                               <block type="text_getSubstring" id="qpcNcW=(fu~!`OS+{2]x">
                                 <mutation at1="true" at2="false"></mutation>
                                 <field name="WHERE1">FROM_START</field>
                                 <field name="WHERE2">LAST</field>
                                 <value name="STRING">
                                   <block type="on_source" id="N}S}nXTKY+pt*D5M|m{r">
                                     <field name="ATTR">state.val</field>
                                   </block>
                                 </value>
                                 <value name="AT1">
                                   <block type="math_number" id="kKPtslp=Q]_j3}g,)_=K">
                                     <field name="NUM">2</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <next>
                               <block type="control" id="smq1BY-E%^xo]/BG_*w)">
                                 <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                 <field name="OID">homee.0.DimmableRGBWLight-81.Color-615</field>
                                 <field name="WITH_DELAY">FALSE</field>
                                 <value name="VALUE">
                                   <block type="procedures_callcustomreturn" id="N;r^{^6UA!u^z9Z)yx:B">
                                     <mutation name="hex2dec">
                                       <arg name="hex"></arg>
                                     </mutation>
                                     <value name="ARG0">
                                       <block type="on_source" id="PVFc5Tw;otlg~9ix;ilc">
                                         <field name="ATTR">state.val</field>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="debug" id="TDS|)8v`Nvfg`8BdE;g}">
                                     <field name="Severity">log</field>
                                     <value name="TEXT">
                                       <shadow type="text" id="CE}CfbUYY,$p?AK9nlEF">
                                         <field name="TEXT">test</field>
                                       </shadow>
                                       <block type="variables_get" id="vURGF1P.rOr,)NPQ7{0M">
                                         <field name="VAR" id="@wly!s9.=$P|eqoW(37w">hex</field>
                                       </block>
                                     </value>
                                     <next>
                                       <block type="debug" id="Ei8A@Yey5*nGcLY(L8tv">
                                         <field name="Severity">log</field>
                                         <value name="TEXT">
                                           <shadow type="text" id=")qSg]71+,+z|]El1R^R3">
                                             <field name="TEXT">test</field>
                                           </shadow>
                                           <block type="procedures_callcustomreturn" id="iBBRl,O]@E~sqpA8,I;t">
                                             <mutation name="hex2dec">
                                               <arg name="hex"></arg>
                                             </mutation>
                                             <value name="ARG0">
                                               <block type="variables_get" id="$#D7f47}*EK:YjcIHz*9">
                                                 <field name="VAR" id="@wly!s9.=$P|eqoW(37w">hex</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                       </block>
                                     </next>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </statement>
                       </block>
                      </xml>
                      

                      DJMarc75D Offline
                      DJMarc75D Offline
                      DJMarc75
                      schrieb am zuletzt editiert von
                      #17

                      @andre3000 Wert mit der Variablen HEX ersetzen:

                      Screenshot 2022-12-13 151550.png

                      Lehrling seit 1975 !!!
                      Beitrag geholfen ? dann gerne ein upvote rechts unten im Beitrag klicken ;)
                      https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge

                      A 1 Antwort Letzte Antwort
                      1
                      • DJMarc75D DJMarc75

                        @andre3000 Wert mit der Variablen HEX ersetzen:

                        Screenshot 2022-12-13 151550.png

                        A Offline
                        A Offline
                        Andre3000
                        schrieb am zuletzt editiert von
                        #18

                        @djmarc75 Das war die Lösung! Jetzt läuft es. Ich danke euch allen für die Mühen und den super schnellen Support.

                        1 Antwort Letzte Antwort
                        0
                        Antworten
                        • In einem neuen Thema antworten
                        Anmelden zum Antworten
                        • Älteste zuerst
                        • Neuste zuerst
                        • Meiste Stimmen


                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        939

                        Online

                        32.5k

                        Benutzer

                        81.8k

                        Themen

                        1.3m

                        Beiträge
                        Community
                        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                        ioBroker Community 2014-2025
                        logo
                        • Anmelden

                        • Du hast noch kein Konto? Registrieren

                        • Anmelden oder registrieren, um zu suchen
                        • Erster Beitrag
                          Letzter Beitrag
                        0
                        • Home
                        • Aktuell
                        • Tags
                        • Ungelesen 0
                        • Kategorien
                        • Unreplied
                        • Beliebt
                        • GitHub
                        • Docu
                        • Hilfe