Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. JSON Inhalt per Mail senden

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    JSON Inhalt per Mail senden

    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MCU @nik82 last edited by

      @nik82 Liegt daran, dass bei mir der DP als Text angelegt ist. Ok.

      1 Reply Last reply Reply Quote 1
      • David G.
        David G. last edited by

        Das scheint ja eine Tabelle aus dem Device Watcher zu sein.

        Eine andere Tabelle aus dem Adapter verarbeite ich wie folgt:

        Screenshot_20230215_151004_Chrome.jpg

        Eine Schleife braucht man ja spätestens wenn mehr wie ein Device enthalten ist.

        M 1 Reply Last reply Reply Quote 0
        • M
          MCU @David G. last edited by

          @david-g Bitte als Export einstellen. Danke.

          David G. 1 Reply Last reply Reply Quote 0
          • David G.
            David G. @MCU last edited by David G.

            @mcu

            Dann baue ich das grad mal, wie es gefragt ist.
            Sekunde.

            Das gezeigte Skript ist riesig.
            (Poste ich, wenn Final und die verwendete json in stable vom device Watcher eingebaut ist)

            Edit:

            Hier ist es:

            Screenshot_20230215_153247_Chrome.jpg

            <block xmlns="https://developers.google.com/blockly/xml" type="on" id="p~];J,|S!,qe[mt|t$)5" x="-112" y="413">
              <field name="OID">device-watcher.0.devices.lowBatteryList</field>
              <field name="CONDITION">ne</field>
              <field name="ACK_CONDITION"></field>
              <statement name="STATEMENT">
                <block type="variables_set" id="F0WG:qg=jh)].vE@MWbj">
                  <field name="VAR" id="zFO+8neFn:/Dd)5d!s.6">mail</field>
                  <value name="VALUE">
                    <block type="text" id="|~0BPq)@6,Zjlq,f~kbe">
                      <field name="TEXT"></field>
                    </block>
                  </value>
                  <next>
                    <block type="variables_set" id="8Mj=.k=w4Vh#}34LgK(O">
                      <field name="VAR" id="(m}dH@gw]g]CrCq4X:^O">Liste</field>
                      <value name="VALUE">
                        <block type="on_source" id="Pcg:+i.].Vgf~,ld#txs">
                          <field name="ATTR">state.val</field>
                        </block>
                      </value>
                      <next>
                        <block type="controls_for" id="/=cLxbv-`@bYIN$CMD7+">
                          <field name="VAR" id="zAL$s=)3)j7:~-3:iGd@">j</field>
                          <value name="FROM">
                            <shadow type="math_number" id="*q5ha^YNfiySP0SOv!R)">
                              <field name="NUM">1</field>
                            </shadow>
                          </value>
                          <value name="TO">
                            <shadow type="math_number" id="y8ZF8G)(tXE,sU3~GbEp">
                              <field name="NUM">10</field>
                            </shadow>
                            <block type="lists_length" id="T@~.7HWor{dlX{C=_sGs">
                              <value name="VALUE">
                                <block type="variables_get" id="TnSi!3p:th-ZVk8mU6Lm">
                                  <field name="VAR" id="(m}dH@gw]g]CrCq4X:^O">Liste</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <value name="BY">
                            <shadow type="math_number" id="KVz8pnE{baO44Qvv-X!}">
                              <field name="NUM">1</field>
                            </shadow>
                          </value>
                          <statement name="DO">
                            <block type="variables_set" id="}DI5b);r@3kSD84#Bwq|">
                              <field name="VAR" id="B=:MPlbZ]`U`oQR_H1ZO">obj</field>
                              <value name="VALUE">
                                <block type="lists_getIndex" id="oNNM2VfP7U?y`NZOa5w3">
                                  <mutation statement="false" at="true"></mutation>
                                  <field name="MODE">GET</field>
                                  <field name="WHERE">FROM_START</field>
                                  <value name="VALUE">
                                    <block type="variables_get" id="uL6x#IJi:5{^eHZ%l^^r">
                                      <field name="VAR" id="(m}dH@gw]g]CrCq4X:^O">Liste</field>
                                    </block>
                                  </value>
                                  <value name="AT">
                                    <block type="variables_get" id="e93ZXe:;1zc^bchT]%gU">
                                      <field name="VAR" id="zAL$s=)3)j7:~-3:iGd@">j</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <next>
                                <block type="variables_set" id="~SU~MbmA,yn3vRS=]Q~M">
                                  <field name="VAR" id="f?3n8ZjQFS#}%A8DqW?=">Device</field>
                                  <value name="VALUE">
                                    <block type="get_attr" id="[zEC?+nZKa~4v!?0^fXP">
                                      <value name="PATH">
                                        <shadow type="text" id="X5MvQwB%1RHimz~-3q@N">
                                          <field name="TEXT">Device</field>
                                        </shadow>
                                      </value>
                                      <value name="OBJECT">
                                        <block type="variables_get" id="pv(FH,1HP0$-(Q@-9#_%">
                                          <field name="VAR" id="B=:MPlbZ]`U`oQR_H1ZO">obj</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="variables_set" id="]F6jOk9c5~qxZ}7[OcMf">
                                      <field name="VAR" id="lUcGMpKcT/DK[V2YRn9}">Adapter</field>
                                      <value name="VALUE">
                                        <block type="get_attr" id="REoGjmX(cpwi.8G|!~i*">
                                          <value name="PATH">
                                            <shadow type="text" id=";F{CV29~=ysctl_rzrSo">
                                              <field name="TEXT">Adapter</field>
                                            </shadow>
                                          </value>
                                          <value name="OBJECT">
                                            <block type="variables_get" id="#gF@]i-pR:;JIh|3HFa6">
                                              <field name="VAR" id="B=:MPlbZ]`U`oQR_H1ZO">obj</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="variables_set" id="ay@CGCCg{/YI](?k[QN#">
                                          <field name="VAR" id="zFO+8neFn:/Dd)5d!s.6">mail</field>
                                          <value name="VALUE">
                                            <block type="text_join" id="u456i^G:Y)/8}U6~UeOK">
                                              <mutation items="5"></mutation>
                                              <value name="ADD0">
                                                <block type="variables_get" id="U3];}l~(3Ap}oUi.Y!7;">
                                                  <field name="VAR" id="zFO+8neFn:/Dd)5d!s.6">mail</field>
                                                </block>
                                              </value>
                                              <value name="ADD1">
                                                <block type="variables_get" id="qX)RYmfz?C:5meq0b1/[">
                                                  <field name="VAR" id="lUcGMpKcT/DK[V2YRn9}">Adapter</field>
                                                </block>
                                              </value>
                                              <value name="ADD2">
                                                <block type="text" id="D0B?mt4f;GdF.ag8gU2x">
                                                  <field name="TEXT">: </field>
                                                </block>
                                              </value>
                                              <value name="ADD3">
                                                <block type="variables_get" id="C9]6;Ety-V.[!S=+3s[d">
                                                  <field name="VAR" id="f?3n8ZjQFS#}%A8DqW?=">Device</field>
                                                </block>
                                              </value>
                                              <value name="ADD4">
                                                <block type="text_newline" id="6H6ER)Si)e-+`UMrGmbg">
                                                  <field name="Type">\n</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="debug" id="jPewu:=,,W[{B[+b8i1M">
                                              <field name="Severity">warn</field>
                                              <value name="TEXT">
                                                <shadow type="text" id="-h/S-HCbO;9C-K9V7zUQ">
                                                  <field name="TEXT">test</field>
                                                </shadow>
                                                <block type="variables_get" id="n87aF7!ymZzS!+a+k$3C">
                                                  <field name="VAR" id="f?3n8ZjQFS#}%A8DqW?=">Device</field>
                                                </block>
                                              </value>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </next>
                            </block>
                          </statement>
                          <next>
                            <block type="email" id="Ts%iYB$79,+SU.kqxKI*">
                              <field name="INSTANCE"></field>
                              <field name="IS_HTML">FALSE</field>
                              <field name="LOG"></field>
                              <value name="TO">
                                <shadow type="text" id="|j@({E{U%*SaGTI$R^?5">
                                  <field name="TEXT"></field>
                                </shadow>
                              </value>
                              <value name="TEXT">
                                <shadow type="text" id="9(yqZT-e0[f-L1kzrtXy">
                                  <field name="TEXT"></field>
                                </shadow>
                                <block type="text_join" id="Tx^@?dVHe4%bh#,Y[Pw!">
                                  <mutation items="3"></mutation>
                                  <value name="ADD0">
                                    <block type="text" id="lMYQrBXjhc-V{Dt@#$9D">
                                      <field name="TEXT">Folgende Geräte haben einen niedrigen Batteriestand:</field>
                                    </block>
                                  </value>
                                  <value name="ADD1">
                                    <block type="text_newline" id=":b}{?*41uHGA@e`{RIg{">
                                      <field name="Type">\n</field>
                                    </block>
                                  </value>
                                  <value name="ADD2">
                                    <block type="variables_get" id="AxXlk;4!d}J][7scn~4@">
                                      <field name="VAR" id="zFO+8neFn:/Dd)5d!s.6">mail</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <value name="SUBJECT">
                                <shadow type="text" id="RiW`G=|5^M/Pd:4)HSKb">
                                  <field name="TEXT">Batteriemeldung</field>
                                </shadow>
                              </value>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                  </next>
                </block>
              </statement>
            </block>
            

            Edit 2:
            Der Debug kann natürlich noch weg, der war für mich.

            nik82 1 Reply Last reply Reply Quote 2
            • nik82
              nik82 Most Active @David G. last edited by

              @david-g
              Danke, ja genau, dass ist vom Device-Watcher 🙂

              David G. 1 Reply Last reply Reply Quote 0
              • David G.
                David G. @nik82 last edited by David G.

                @nik82

                Aber der kann dir doch auch ohne Skript Mails senden?
                Fat mir grad mal so ein.

                nik82 1 Reply Last reply Reply Quote 0
                • nik82
                  nik82 Most Active @David G. last edited by

                  @david-g
                  Richtig, lasse ich mir auch schicken, aber wenn eine Batterie leer ist, dann will ich da eine extra Mail haben gleich mit dem Betreff 🙂

                  David G. 1 Reply Last reply Reply Quote 0
                  • David G.
                    David G. @nik82 last edited by

                    @nik82

                    Ich merke grad nur, dass ich die Mail alle 10sek bekomme, wenn das Skript aktiv ist. Aber eigentlich ändert sich IM Datenpunkt ja nichts....

                    Mal schauen.

                    nik82 1 Reply Last reply Reply Quote 0
                    • nik82
                      nik82 Most Active @David G. last edited by

                      @david-g
                      Also das funktioniert bei mir eigentlich echt gut, es kommt wirklich nur was wenn sich etwas ändert...

                      David G. 1 Reply Last reply Reply Quote 0
                      • David G.
                        David G. @nik82 last edited by

                        @nik82

                        Interessant.
                        Die letzte Änderung liegt bei mir auch schon was her.

                        Kommt trotzdem alle 10sek die Mail.
                        Screenshot_20230215_161253_Chrome.jpg

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        469
                        Online

                        32.0k
                        Users

                        80.5k
                        Topics

                        1.3m
                        Posts

                        3
                        21
                        1213
                        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