Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. JS-Funktion mit Ergebnis - Hexadezimal zu Dezimal

    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

    JS-Funktion mit Ergebnis - Hexadezimal zu Dezimal

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

      @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
      }
      
      paul53 1 Reply Last reply Reply Quote 0
      • apollon77
        apollon77 @Andre3000 last edited by

        @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

        1 Reply Last reply Reply Quote 1
        • paul53
          paul53 @Andre3000 last edited by paul53

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

          Bild_2022-12-13_141623924.png

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

            @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
            
            paul53 1 Reply Last reply Reply Quote 0
            • paul53
              paul53 @Andre3000 last edited by

              @andre3000 sagte: "#0800ff"

              Das "#" ist zu viel.

              Bild_2022-12-13_142103341.png

              A 1 Reply Last reply Reply Quote 1
              • A
                Andre3000 @paul53 last edited by 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"
                
                paul53 1 Reply Last reply Reply Quote 0
                • paul53
                  paul53 @Andre3000 last edited by paul53

                  @andre3000 sagte: Allerdings weiterhin:

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

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

                    @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.

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

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

                      Zeige mal das aktuelle Blockly.

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

                        @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>
                        

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

                          @andre3000 Wert mit der Variablen HEX ersetzen:

                          Screenshot 2022-12-13 151550.png

                          A 1 Reply Last reply Reply Quote 1
                          • A
                            Andre3000 @DJMarc75 last edited by

                            @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 Reply Last reply Reply Quote 0
                            • First post
                              Last post

                            Support us

                            ioBroker
                            Community Adapters
                            Donate

                            709
                            Online

                            31.9k
                            Users

                            80.1k
                            Topics

                            1.3m
                            Posts

                            4
                            18
                            857
                            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