Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [Gelöst] Unifi Voucher Anzeige

    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

    [Gelöst] Unifi Voucher Anzeige

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

      Re: [gelöst] Unifi Voucher per Telegram senden

      Hi Zusammen,
      mit diesen Skript konnte ich "fast" mein vorhaben realisieren 🙂 Und zwar die Anzeige des letzten gültigen Vouchers. Wenn kein Voucher vorhanden ist dann soll "NIX" etc. in einen definierten Datenpunkt stehen.
      Das Problem ist aber, das der Zählwert der alten Vouchers nicht auf 0 springt, sondern auf 1 stehen bleibt, wenn kein Voucher mehr vorhanden ist. Was muss ich an diesen Script ändern das dies gefixt ist?

      @liv-in-sky Zur Info da es dein Script war 🙂 Aber vielleicht kann ja ein anderer von euch Profis das auch lösen.

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

        @draexler

        bei meinen tests wird unter vouches ein voucher angezeigt (mit null werten), auch wenn kein "richtiges" voucher angelegt ist.

        teste mal diese erweiterung zum script, ob es dann besser ist - bzw ob dann "0" drin steht - muss in die function"abfrage" rein

        Image 1.png

        if(!id.includes("voucher_.create")){
        
        }
        
        draexler 1 Reply Last reply Reply Quote 1
        • draexler
          draexler @liv-in-sky last edited by

          @liv-in-sky said in Unifi Voucher Anzeige:

          if(!id.includes("voucher_.create")){

          WOW, super für die schnelle Hilfe. Erste Test waren erfolgreich.
          Danke dir.

          1 Reply Last reply Reply Quote 0
          • J
            jensus11 last edited by

            @draexler

            lässt du dir das per Telegramm senden?

            draexler 1 Reply Last reply Reply Quote 0
            • draexler
              draexler @jensus11 last edited by

              @jensus11 Ja, mache ich.

              1 Reply Last reply Reply Quote 0
              • J
                jensus11 last edited by

                @draexler
                Könntest du dein Script mal posten? Bei mir läuft das nicht richtig.

                draexler 1 Reply Last reply Reply Quote 0
                • draexler
                  draexler @jensus11 last edited by

                  @jensus11: Also ich habe dafür zwei eigene Datenpunkte. In ein Datenpunkt wird die "Rohinformation" aus dem oberen Script eingetragen und aus dieser "extrahiere" ich den Code in ein anderes. Das ganze Steuere ich über ein HTML Basic Widget in der VIS -> Deswegen wirst du im Skript auch "PUSH" finden. Das ist nur für die Anzeige in der VIS.

                  <xml xmlns="https://developers.google.com/blockly/xml">
                    <block type="schedule" id="]HqNEVPrp%eBbM@k~r+H" x="-88" y="337">
                      <field name="SCHEDULE">*/5 * * * * *</field>
                      <statement name="STATEMENT">
                        <block type="debug" id="{ghV!-08$,GCh{?fa.ir">
                          <field name="Severity">log</field>
                          <value name="TEXT">
                            <shadow type="text" id="0oaP-:bjPhGxp$SQ3P%+">
                              <field name="TEXT">test</field>
                            </shadow>
                            <block type="procedures_callcustomreturn" id="6^QlcTB7bd|1cQd%I)1`">
                              <mutation name="abfrage"></mutation>
                            </block>
                          </value>
                          <next>
                            <block type="controls_if" id="45ZX~f{_+)P?^)HGBY4P">
                              <mutation elseif="2"></mutation>
                              <value name="IF0">
                                <block type="logic_compare" id="H;R-/TMw(VsUwF3[Op;b">
                                  <field name="OP">NEQ</field>
                                  <value name="A">
                                    <block type="procedures_callcustomreturn" id="IX(jO~K+]D$n`0=vp*fh">
                                      <mutation name="abfrage"></mutation>
                                    </block>
                                  </value>
                                  <value name="B">
                                    <block type="math_number" id="7J@U+96^d~`Wi`;Xz5bE">
                                      <field name="NUM">0</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <statement name="DO0">
                                <block type="update" id="n=5#RjYy}Uf;n:]jxr;J">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                  <field name="OID">0_userdata.0.VIS_Datenpunkte.UNIFI.Gaeste_Voucher_Rohdaten</field>
                                  <field name="WITH_DELAY">FALSE</field>
                                  <value name="VALUE">
                                    <block type="procedures_callcustomreturn" id="Z.[)9rooL~4cj!mE4$/%">
                                      <mutation name="abfrage"></mutation>
                                    </block>
                                  </value>
                                </block>
                              </statement>
                              <value name="IF1">
                                <block type="logic_compare" id="ag2O4zm?cgakM3H7D(5j">
                                  <field name="OP">EQ</field>
                                  <value name="A">
                                    <block type="get_value" id="ep~72X|r+PU^WzN|hH`9">
                                      <field name="ATTR">val</field>
                                      <field name="OID">0_userdata.0.VIS_Datenpunkte.UNIFI.Voucherueberwachung</field>
                                    </block>
                                  </value>
                                  <value name="B">
                                    <block type="math_number" id="z?;RFe(t;7sz0P|L8z=?">
                                      <field name="NUM">0</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <statement name="DO1">
                                <block type="update" id="WWfap=#y{5@omA2cM,eU">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                  <field name="OID">0_userdata.0.VIS_Datenpunkte.UNIFI.Gaeste_Voucher_Rohdaten</field>
                                  <field name="WITH_DELAY">FALSE</field>
                                  <value name="VALUE">
                                    <block type="text" id="`[VhTIV7K#:{l??Y0*.v">
                                      <field name="TEXT">NULL</field>
                                    </block>
                                  </value>
                                </block>
                              </statement>
                              <value name="IF2">
                                <block type="logic_compare" id="T=3aA;s0BhL|8JsQWHqW">
                                  <field name="OP">EQ</field>
                                  <value name="A">
                                    <block type="procedures_callcustomreturn" id="#H(0~_/+A^(T!zs(AA:Q">
                                      <mutation name="abfrage"></mutation>
                                    </block>
                                  </value>
                                  <value name="B">
                                    <block type="math_number" id="h)mKLwP#tdJV/mF4Fnt=">
                                      <field name="NUM">0</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                            </block>
                          </next>
                        </block>
                      </statement>
                      <next>
                        <block type="on" id="uA-2ocH$(-~}|#9))(gL">
                          <field name="OID">0_userdata.0.VIS_Datenpunkte.UNIFI.Gaeste_Voucher_Rohdaten</field>
                          <field name="CONDITION">any</field>
                          <field name="ACK_CONDITION"></field>
                          <statement name="STATEMENT">
                            <block type="controls_if" id="tt5(7E7PfGS$ex=Vx}0j">
                              <mutation elseif="1"></mutation>
                              <value name="IF0">
                                <block type="logic_compare" id="-`m)UT0I{oS$6Aqq.ne}">
                                  <field name="OP">EQ</field>
                                  <value name="A">
                                    <block type="get_value" id="8)]s?,zSbCeKEmNJZ[c,">
                                      <field name="ATTR">val</field>
                                      <field name="OID">0_userdata.0.VIS_Datenpunkte.UNIFI.Gaeste_Voucher_Rohdaten</field>
                                    </block>
                                  </value>
                                  <value name="B">
                                    <block type="text" id="V6MD!+iEP/-y5xveOu5W">
                                      <field name="TEXT">NULL</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <statement name="DO0">
                                <block type="update" id="^|qf0Xjj.3m:h4(2@Eh+">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                  <field name="OID">0_userdata.0.VIS_Datenpunkte.UNIFI.Gaeste_Voucher</field>
                                  <field name="WITH_DELAY">FALSE</field>
                                  <value name="VALUE">
                                    <block type="text" id="l$ObO~*RpUGH/T|:(Z;1">
                                      <field name="TEXT">PUSH</field>
                                    </block>
                                  </value>
                                </block>
                              </statement>
                              <value name="IF1">
                                <block type="logic_compare" id="+8Hqd;6T`9:^8BF($t|@">
                                  <field name="OP">NEQ</field>
                                  <value name="A">
                                    <block type="get_value" id="K:I`Y7+?cQZe7!^)/Ap?">
                                      <field name="ATTR">val</field>
                                      <field name="OID">0_userdata.0.VIS_Datenpunkte.UNIFI.Gaeste_Voucher_Rohdaten</field>
                                    </block>
                                  </value>
                                  <value name="B">
                                    <block type="text" id=":k7U5A%96#CG6Dul7o/=">
                                      <field name="TEXT">NULL</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <statement name="DO1">
                                <block type="update" id=":.1Y-ldY.Bw%=xOWpUw`">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                  <field name="OID">0_userdata.0.VIS_Datenpunkte.UNIFI.Gaeste_Voucher</field>
                                  <field name="WITH_DELAY">FALSE</field>
                                  <value name="VALUE">
                                    <block type="text_join" id="Wmylzz,WMg(+|Th#?*Zn">
                                      <mutation items="3"></mutation>
                                      <value name="ADD0">
                                        <block type="text_getSubstring" id=")SbpJ=ZC]`YRBPqL0q0@">
                                          <mutation at1="true" at2="true"></mutation>
                                          <field name="WHERE1">FROM_START</field>
                                          <field name="WHERE2">FROM_START</field>
                                          <value name="STRING">
                                            <block type="get_value" id="VM91^k42+O^J+adOhI~~">
                                              <field name="ATTR">val</field>
                                              <field name="OID">0_userdata.0.VIS_Datenpunkte.UNIFI.Gaeste_Voucher_Rohdaten</field>
                                            </block>
                                          </value>
                                          <value name="AT1">
                                            <block type="math_number" id="g@tay]OdUj7o`%.L{8qO">
                                              <field name="NUM">34</field>
                                            </block>
                                          </value>
                                          <value name="AT2">
                                            <block type="math_number" id="]:Ikjm*^I[*+K#}C|eGG">
                                              <field name="NUM">38</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <value name="ADD1">
                                        <block type="text" id="Qiy`.R-V:^FJ/XBIy:nQ">
                                          <field name="TEXT">-</field>
                                        </block>
                                      </value>
                                      <value name="ADD2">
                                        <block type="text_getSubstring" id="@VsZ.M8V`(V%(WU-2f4G">
                                          <mutation at1="true" at2="true"></mutation>
                                          <field name="WHERE1">FROM_START</field>
                                          <field name="WHERE2">FROM_START</field>
                                          <value name="STRING">
                                            <block type="get_value" id="z]$1mj[%fXFYLHzG:!HY">
                                              <field name="ATTR">val</field>
                                              <field name="OID">0_userdata.0.VIS_Datenpunkte.UNIFI.Gaeste_Voucher_Rohdaten</field>
                                            </block>
                                          </value>
                                          <value name="AT1">
                                            <block type="math_number" id="qg!$WvwLcH@H;Vo|nAP}">
                                              <field name="NUM">39</field>
                                            </block>
                                          </value>
                                          <value name="AT2">
                                            <block type="math_number" id="$W9{Km-|#LLRd$/gdSUU">
                                              <field name="NUM">43</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="telegram" id="SArGTtqFiW2pA1pw]2m{">
                                      <field name="INSTANCE">.0</field>
                                      <field name="LOG"></field>
                                      <field name="SILENT">FALSE</field>
                                      <field name="PARSEMODE">default</field>
                                      <value name="MESSAGE">
                                        <shadow type="text" id="BLh:8cYopcV,Jr2+0P)B">
                                          <field name="TEXT">text</field>
                                        </shadow>
                                        <block type="text_join" id="(i]2z~o~jp|C!kck4)z+">
                                          <mutation items="9"></mutation>
                                          <value name="ADD0">
                                            <block type="text" id="g+i0M|hx6]`u^s+~nl{`">
                                              <field name="TEXT">Der Gäste WLAN Voucher lautet:</field>
                                            </block>
                                          </value>
                                          <value name="ADD1">
                                            <block type="text_newline" id="HUFK%`Z9k/B!F]N1=Zzk">
                                              <field name="Type">\n</field>
                                            </block>
                                          </value>
                                          <value name="ADD2">
                                            <block type="text_newline" id="da_VBU6+I9~7mR]IY*k@">
                                              <field name="Type">\n</field>
                                            </block>
                                          </value>
                                          <value name="ADD3">
                                            <block type="text_getSubstring" id="qqt])D}z=KmUInmg[@kv">
                                              <mutation at1="true" at2="true"></mutation>
                                              <field name="WHERE1">FROM_START</field>
                                              <field name="WHERE2">FROM_START</field>
                                              <value name="STRING">
                                                <block type="get_value" id="@WGOh:+~FW1j5)z!z)F-">
                                                  <field name="ATTR">val</field>
                                                  <field name="OID">0_userdata.0.VIS_Datenpunkte.UNIFI.Gaeste_Voucher_Rohdaten</field>
                                                </block>
                                              </value>
                                              <value name="AT1">
                                                <block type="math_number" id="^.#qfn/P_!,C*Xq043]*">
                                                  <field name="NUM">34</field>
                                                </block>
                                              </value>
                                              <value name="AT2">
                                                <block type="math_number" id="NxW(/#g:$vf,CwhogA#|">
                                                  <field name="NUM">38</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <value name="ADD4">
                                            <block type="text" id="f0f?%E-jU~,q])UozY8i">
                                              <field name="TEXT">-</field>
                                            </block>
                                          </value>
                                          <value name="ADD5">
                                            <block type="text_getSubstring" id="d%L@9U0q-DUo(%zy(F1S">
                                              <mutation at1="true" at2="true"></mutation>
                                              <field name="WHERE1">FROM_START</field>
                                              <field name="WHERE2">FROM_START</field>
                                              <value name="STRING">
                                                <block type="get_value" id="1sOqumB[NtUTBwbhb*t9">
                                                  <field name="ATTR">val</field>
                                                  <field name="OID">0_userdata.0.VIS_Datenpunkte.UNIFI.Gaeste_Voucher_Rohdaten</field>
                                                </block>
                                              </value>
                                              <value name="AT1">
                                                <block type="math_number" id="GA[OYxzL%-bzZ1U[1.YL">
                                                  <field name="NUM">39</field>
                                                </block>
                                              </value>
                                              <value name="AT2">
                                                <block type="math_number" id="}0,?Z[*Yy`#*OVPt%_8}">
                                                  <field name="NUM">43</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <value name="ADD6">
                                            <block type="text_newline" id="c5)LG%{#_-E#[p_a9N]d">
                                              <field name="Type">\n</field>
                                            </block>
                                          </value>
                                          <value name="ADD7">
                                            <block type="text_newline" id="QW6.6ARc?n8;Xo41dM:T">
                                              <field name="Type">\n</field>
                                            </block>
                                          </value>
                                          <value name="ADD8">
                                            <block type="text" id="TWU~NYQQa!.Yds}5(WQV">
                                              <field name="TEXT">Viel Spaß</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                    </block>
                                  </next>
                                </block>
                              </statement>
                            </block>
                          </statement>
                        </block>
                      </next>
                    </block>
                    <block type="procedures_defcustomreturn" id="5n~Iiupl2*1_L7rk?4xW" x="237" y="338">
                      <mutation statements="false"></mutation>
                      <field name="NAME">abfrage</field>
                      <field name="SCRIPT">ICBjb25zdCBkcFByZWZpeCA9ICIwX3VzZXJkYXRhLjAuVklTX0RhdGVucHVua3RlLiI7DQogIGxldCBhcnJUcmlnZ2VyPVtdOw0KICBsZXQgY291bnQ9MA0KIC8vIGxvZygic3RhcnRlIik7DQogbGV0IGFs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GNvdW50KQ0KDQoNCmFyclRyaWdnZXIuc29ydChmdW5jdGlvbiAoYWxwaGEsIGJldGEpIHsNCiAgICAgICAgICAgICANCiAgICAgICAgICAgICAgcmV0dXJuICBiZXRhWzBdLSBhbHBoYVswXTsNCiAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICANCiAgICBpZiAoIGFsdGVyV2VydDxjb3VudCkgIHtyZXR1cm4gYXJyVHJpZ2dlclswXVsxXTsgICB9IGVsc2UgIHsgcmV0dXJuICIwIjt9ICAgDQogICAgYWx0ZXJXZXJ0PWNvdW50ICANCiAgICAgICAgICAgICANCg==</field>
                      <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                    </block>
                  </xml>
                  
                  1 Reply Last reply Reply Quote 0
                  • J
                    jensus11 last edited by

                    @draexler sagte in Unifi Voucher Anzeige:

                    [gelöst] Unifi Voucher per Telegram senden

                    @draexler
                    Wie machst du das denn mit dem Extrahieren vom Code? Bei mir wird mit dem ersten Skript nur ein Datenpunkt erzeugt in dem die Anzahl der vorhandenen Codes steht, aber nicht der Code selber.
                    Diesen finde ich nur im Objektordner vom Unifi-Adapter.

                    draexler 1 Reply Last reply Reply Quote 0
                    • draexler
                      draexler @jensus11 last edited by draexler

                      @jensus11 Hast du schon die Datenpunkte angelegt wie sie auch im extrahierten Blockly sind? Auch die in der JS FunktionBildschirmfoto 2021-08-07 um 17.44.27.png

                      Ich halte die Datenpunkte im 0_Userdata fest, damit ich alles an einen Ort habe.

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

                      Support us

                      ioBroker
                      Community Adapters
                      Donate

                      680
                      Online

                      31.9k
                      Users

                      80.2k
                      Topics

                      1.3m
                      Posts

                      3
                      9
                      337
                      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