Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Email als Auslöser für Pushmail

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Email als Auslöser für Pushmail

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

      Hallo Zusammen,

      leider komme ich mit meinen Fähigkeiten bei den Skripten immer wieder sehr schnell an einen Punkt an dem ich die Fehler auch mit mehrfachen rumprobieren nicht verstehe. So auch jetzt schon wieder...
      Für den bald eintreffenden Nachwuchs wurde eine Webcam (Foscam) mit Geräuscherkennung als Babyfon angeschafft. Da die Kamera gerne mit seinem Hersteller telefoniert habe ich alle Verbindungen außer zu meinem Mailserver gesperrt.

      Die Kamera hängt an einer geschalteten Steckdose. Diese wird über VIS ein- und ausgeschaltet.

      Aktuell versendet nun die Kamera bei Alarm über meine Adresse babyfon@ an die Adresse iobroker@. Diese Adresse wird von ioBroker abgehört. Der ioBroker soll dann über Pushover die Nachricht auf unsere Handys, Tablets und VIS Displays senden.

      Da die Kamera aber bei jeder Bewegung innerhalb von 15 Sekunden die nächste Mail versendet will ich da eine Bremse einbauen. Hierfür ist auf der CCU eine Systemvariable gesetzt. Diese will ich mit ioBroker auslesen. Wenn Status = wahr, soll die Pushmail rausgehen. Danach soll der Status für x Minuten auf falsch gesetzt werden damit mir die Foscam nicht zig Alarme auslöst.

      Das Skript sieht so aus:

      Blokly.PNG

      Kann einer mal dem Dummie unter die Arme greifen?

      1 Reply Last reply Reply Quote 0
      • T
        ticaki Developer last edited by

        die unteren beiden Steueranweisungen müssen im Fallsblock sein nicht darunter.

        1 Reply Last reply Reply Quote 0
        • M
          Michi 0 last edited by

          Damit will´s auch nicht so richtig.
          Jetzt hab ich aber zumindest ne Fehlermeldung im Log sobald die eMail auf iobroker@ eingeht 😉

          "(10608) Error by subscription: empty ID defined. All states matched."

          T 1 Reply Last reply Reply Quote 0
          • T
            ticaki Developer @Michi 0 last edited by ticaki

            @Michi-0
            Jup, hab den Fehler ganz oben übersehen.

            Falls Objekt Bildschirmfoto 2020-04-05 um 08.49.23.png
            das muß so aussehen:Bildschirmfoto 2020-04-05 um 08.53.58.png

            Trigger reagieren auf Änderungen du mußt innerhalb des Triggers prüfen, ob die Email die richtige ist.

            1 Reply Last reply Reply Quote 0
            • M
              Michi 0 last edited by

              Klappt auch nicht...

              Hab mir jetzt mal ein Skript erstellt um mir Pushnachrichten zu schicken -> hat einwandfrei geklappt. Die "Eingangsmailerkennung" haut auch wunderbar hin.

              Blokly1.PNG

              Und wie bekomme ich denn bei diesem Aufbau die zweite Bedingung mit dazu? Pushnachricht nur wenn Systemstatus "Babyfon Alarmierung" auf "wahr"?

              1 Reply Last reply Reply Quote 0
              • T
                ticaki Developer last edited by ticaki

                Das ist falsch:

                Du mußt das Objekt auf das du reagieren willst dort auswählen wo aktuell default steht. Dann mußt du schauen, ob es die richtige Mail ist, und dann ob deine Variable true ist.

                Kannst du das aktuelle Blockly exportieren, dann baue ich es dir gerade um auf funktionierend?
                Bildschirmfoto 2020-04-05 um 11.53.33.png
                Bildschirmfoto 2020-04-05 um 11.53.39.png

                und den XML Text hier einfügen komplett in code tags Bildschirmfoto 2020-04-05 um 11.54.25.png

                1 Reply Last reply Reply Quote 0
                • M
                  Michi 0 last edited by

                  Wenn mich Deine Hilfe nicht so freuen würde wäre mir meine Unkenntnis echt peinlich...

                  <xml xmlns="http://www.w3.org/1999/xhtml">
                    <block type="comment" id="XB`8D{mZtDo6X?CQh]uA" x="63" y="38">
                      <field name="COMMENT">Alarmierung von Kamera</field>
                      <next>
                        <block type="on_ext" id="mJIIl{*fEP3^mrJ).}4S">
                          <mutation items="1"></mutation>
                          <field name="CONDITION">any</field>
                          <field name="ACK_CONDITION"></field>
                          <value name="OID0">
                            <shadow type="field_oid" id="Yo-#vbdwVO7V$lye#s[u">
                              <field name="oid">default</field>
                            </shadow>
                          </value>
                          <statement name="STATEMENT">
                            <block type="comment" id="7!+b|Uwd)leQ_C#%1%Y|">
                              <field name="COMMENT">Versenden von Pushmails</field>
                              <next>
                                <block type="controls_if" id="eb4}8-baqa|.^2|0swc=">
                                  <value name="IF0">
                                    <block type="logic_compare" id="kBMnnvGc`*iV[M,ZdBu%">
                                      <field name="OP">EQ</field>
                                      <value name="A">
                                        <block type="field_oid" id="MQl]WQ7:cYcx0Sl/!MNi">
                                          <field name="oid">javascript.0.IMAP.Email_Eingang</field>
                                        </block>
                                      </value>
                                      <value name="B">
                                        <block type="text" id="s{j~@iWbLVqDvsH!qVPO">
                                          <field name="TEXT">babyfon@xxx.com</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <statement name="DO0">
                                    <block type="pushover" id="S5YL`7CF:R3N=skA6m+p">
                                      <field name="INSTANCE"></field>
                                      <field name="SOUND"></field>
                                      <field name="PRIORITY">0</field>
                                      <field name="LOG">log</field>
                                      <value name="MESSAGE">
                                        <shadow type="text" id="@JNqX52l6xaGq61A.2)h">
                                          <field name="TEXT">Babyfon Alarm</field>
                                        </shadow>
                                        <block type="text" id="A%jaJIjR).Bg#[,N7b5m">
                                          <field name="TEXT">Babyfon Alarm</field>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="comment" id="%cBYj.$wY^UJDhEdqQy5">
                                          <field name="COMMENT">Daueralarm vermeiden</field>
                                          <next>
                                            <block type="control" id="{rwIKZ#VhlG4,8)dTt-F">
                                              <mutation delay_input="false"></mutation>
                                              <field name="OID">hm-rega.0.19714</field>
                                              <field name="WITH_DELAY">FALSE</field>
                                              <value name="VALUE">
                                                <block type="logic_boolean" id="pu+KS!_f%}qgF=jRpSD6">
                                                  <field name="BOOL">FALSE</field>
                                                </block>
                                              </value>
                                              <next>
                                                <block type="control" id="UG6lp}_EcnD6d+(9MK`V">
                                                  <mutation delay_input="true"></mutation>
                                                  <field name="OID">hm-rega.0.19714</field>
                                                  <field name="WITH_DELAY">TRUE</field>
                                                  <field name="DELAY_MS">5</field>
                                                  <field name="UNIT">min</field>
                                                  <field name="CLEAR_RUNNING">FALSE</field>
                                                  <value name="VALUE">
                                                    <block type="logic_boolean" id="ouW4ro`j:oI=AR(m${~l">
                                                      <field name="BOOL">TRUE</field>
                                                    </block>
                                                  </value>
                                                </block>
                                              </next>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </statement>
                                </block>
                              </next>
                            </block>
                          </statement>
                        </block>
                      </next>
                    </block>
                  </xml>
                  
                  1 Reply Last reply Reply Quote 0
                  • T
                    ticaki Developer last edited by ticaki

                    Du mußt noch eine Sache anpassen. Ich kann hm-rega.0.19714 nicht abfragen, das ich das Objekt nicht habe. Du mußt die Variable die ich eingefügt habe gegen eine abfrage auf dieses Objekt ersetzen.
                    Bildschirmfoto 2020-04-05 um 12.08.03.png

                    <block xmlns="http://www.w3.org/1999/xhtml" type="on_ext" id="mJIIl{*fEP3^mrJ).}4S" x="88" y="126">
                      <mutation items="1"></mutation>
                      <field name="CONDITION">ne</field>
                      <field name="ACK_CONDITION"></field>
                      <value name="OID0">
                        <shadow type="field_oid" id="Yo-#vbdwVO7V$lye#s[u">
                          <field name="oid">default</field>
                        </shadow>
                        <block type="field_oid" id="Q,a_@#_28e1XjAR;bwr~">
                          <field name="oid">javascript.0.IMAP.Email_Eingang</field>
                        </block>
                      </value>
                      <statement name="STATEMENT">
                        <block type="comment" id="7!+b|Uwd)leQ_C#%1%Y|">
                          <field name="COMMENT">Versenden von Pushmails</field>
                          <next>
                            <block type="controls_if" id="eb4}8-baqa|.^2|0swc=">
                              <value name="IF0">
                                <block type="logic_compare" id="kBMnnvGc`*iV[M,ZdBu%">
                                  <field name="OP">EQ</field>
                                  <value name="A">
                                    <block type="field_oid" id="MQl]WQ7:cYcx0Sl/!MNi">
                                      <field name="oid">javascript.0.IMAP.Email_Eingang</field>
                                    </block>
                                  </value>
                                  <value name="B">
                                    <block type="text" id="s{j~@iWbLVqDvsH!qVPO">
                                      <field name="TEXT">babyfon@xxx.com</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <statement name="DO0">
                                <block type="controls_if" id="!f,dlg!xU1/Rc:O$-?+]">
                                  <value name="IF0">
                                    <block type="variables_get" id="z3/+TKTOmKikk!VP%xM]">
                                      <field name="VAR" id="^n$8WR=W#/}qTyXWIP}[" variabletype="">Hier bitte hm-rega.0.19714 einfügen</field>
                                    </block>
                                  </value>
                                  <statement name="DO0">
                                    <block type="pushover" id="S5YL`7CF:R3N=skA6m+p">
                                      <field name="INSTANCE"></field>
                                      <field name="SOUND"></field>
                                      <field name="PRIORITY">0</field>
                                      <field name="LOG">log</field>
                                      <value name="MESSAGE">
                                        <shadow type="text" id="@JNqX52l6xaGq61A.2)h">
                                          <field name="TEXT">Babyfon Alarm</field>
                                        </shadow>
                                        <block type="text" id="A%jaJIjR).Bg#[,N7b5m">
                                          <field name="TEXT">Babyfon Alarm</field>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="comment" id="%cBYj.$wY^UJDhEdqQy5">
                                          <field name="COMMENT">Daueralarm vermeiden</field>
                                          <next>
                                            <block type="control" id="{rwIKZ#VhlG4,8)dTt-F">
                                              <mutation delay_input="false"></mutation>
                                              <field name="OID">hm-rega.0.19714</field>
                                              <field name="WITH_DELAY">FALSE</field>
                                              <value name="VALUE">
                                                <block type="logic_boolean" id="pu+KS!_f%}qgF=jRpSD6">
                                                  <field name="BOOL">FALSE</field>
                                                </block>
                                              </value>
                                              <next>
                                                <block type="control" id="UG6lp}_EcnD6d+(9MK`V">
                                                  <mutation delay_input="true"></mutation>
                                                  <field name="OID">hm-rega.0.19714</field>
                                                  <field name="WITH_DELAY">TRUE</field>
                                                  <field name="DELAY_MS">5</field>
                                                  <field name="UNIT">min</field>
                                                  <field name="CLEAR_RUNNING">FALSE</field>
                                                  <value name="VALUE">
                                                    <block type="logic_boolean" id="ouW4ro`j:oI=AR(m${~l">
                                                      <field name="BOOL">TRUE</field>
                                                    </block>
                                                  </value>
                                                </block>
                                              </next>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </statement>
                                </block>
                              </statement>
                            </block>
                          </next>
                        </block>
                      </statement>
                    </block>
                    

                    EDIT:
                    Und zur Erläuterung. Ich setzte hm-rega.0.19714 direkt am Anfang auf wahr, damit ein Neustart während dem 5 Minuten Zeitfenster nicht dafür sorgt dass hm-rega.0.19714 für immer unwahr bleibt.

                    1 Reply Last reply Reply Quote 0
                    • M
                      Michi 0 last edited by

                      So langsam schlägt mir die Corona-Ausgangsbeschränkung wohl aufs Hirn... Es klappt immer noch nicht (Die Mailadresse hatte ich angepasst).
                      Und dann noch eine Verständnisfrage:
                      Wo hast Du am Anfang hm-rega.0.19714 auf wahr gesetzt?

                      Blokly2.PNG

                      <block xmlns="http://www.w3.org/1999/xhtml" type="on_ext" id="mJIIl{*fEP3^mrJ).}4S" x="13" y="-187">
                        <mutation items="1"></mutation>
                        <field name="CONDITION">ne</field>
                        <field name="ACK_CONDITION"></field>
                        <value name="OID0">
                          <shadow type="field_oid" id="Yo-#vbdwVO7V$lye#s[u">
                            <field name="oid">default</field>
                          </shadow>
                          <block type="field_oid" id="Q,a_@#_28e1XjAR;bwr~">
                            <field name="oid">javascript.0.IMAP.Email_Eingang</field>
                          </block>
                        </value>
                        <statement name="STATEMENT">
                          <block type="comment" id="7!+b|Uwd)leQ_C#%1%Y|">
                            <field name="COMMENT">Versenden von Pushmails</field>
                            <next>
                              <block type="controls_if" id="eb4}8-baqa|.^2|0swc=">
                                <value name="IF0">
                                  <block type="logic_compare" id="kBMnnvGc`*iV[M,ZdBu%">
                                    <field name="OP">EQ</field>
                                    <value name="A">
                                      <block type="field_oid" id="MQl]WQ7:cYcx0Sl/!MNi">
                                        <field name="oid">javascript.0.IMAP.Email_Eingang</field>
                                      </block>
                                    </value>
                                    <value name="B">
                                      <block type="text" id="s{j~@iWbLVqDvsH!qVPO">
                                        <field name="TEXT">babyfon@xxx.com</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                                <statement name="DO0">
                                  <block type="controls_if" id="!f,dlg!xU1/Rc:O$-?+]">
                                    <value name="IF0">
                                      <block type="logic_compare" id="]~Ku(g@^ef651Wf-$qES">
                                        <field name="OP">EQ</field>
                                        <value name="A">
                                          <block type="get_value" id="{rzGCO1MAg|G5eE[mb;7">
                                            <field name="ATTR">val</field>
                                            <field name="OID">hm-rega.0.19714</field>
                                          </block>
                                        </value>
                                        <value name="B">
                                          <block type="logic_boolean" id="ef1PU4l8;;`UD!2(ZnK6">
                                            <field name="BOOL">TRUE</field>
                                          </block>
                                        </value>
                                      </block>
                                    </value>
                                    <statement name="DO0">
                                      <block type="pushover" id="S5YL`7CF:R3N=skA6m+p">
                                        <field name="INSTANCE"></field>
                                        <field name="SOUND"></field>
                                        <field name="PRIORITY">0</field>
                                        <field name="LOG">log</field>
                                        <value name="MESSAGE">
                                          <shadow type="text" id="@JNqX52l6xaGq61A.2)h">
                                            <field name="TEXT">Babyfon Alarm</field>
                                          </shadow>
                                          <block type="text" id="A%jaJIjR).Bg#[,N7b5m">
                                            <field name="TEXT">Babyfon Alarm</field>
                                          </block>
                                        </value>
                                        <next>
                                          <block type="comment" id="%cBYj.$wY^UJDhEdqQy5">
                                            <field name="COMMENT">Daueralarm vermeiden</field>
                                            <next>
                                              <block type="control" id="{rwIKZ#VhlG4,8)dTt-F">
                                                <mutation delay_input="false"></mutation>
                                                <field name="OID">hm-rega.0.19714</field>
                                                <field name="WITH_DELAY">FALSE</field>
                                                <value name="VALUE">
                                                  <block type="logic_boolean" id="pu+KS!_f%}qgF=jRpSD6">
                                                    <field name="BOOL">FALSE</field>
                                                  </block>
                                                </value>
                                                <next>
                                                  <block type="control" id="UG6lp}_EcnD6d+(9MK`V">
                                                    <mutation delay_input="true"></mutation>
                                                    <field name="OID">hm-rega.0.19714</field>
                                                    <field name="WITH_DELAY">TRUE</field>
                                                    <field name="DELAY_MS">5</field>
                                                    <field name="UNIT">min</field>
                                                    <field name="CLEAR_RUNNING">FALSE</field>
                                                    <value name="VALUE">
                                                      <block type="logic_boolean" id="ouW4ro`j:oI=AR(m${~l">
                                                        <field name="BOOL">TRUE</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </statement>
                                  </block>
                                </statement>
                              </block>
                            </next>
                          </block>
                        </statement>
                      </block>
                      
                      1 Reply Last reply Reply Quote 0
                      • T
                        ticaki Developer last edited by ticaki

                        Hm, ist nicht da... Füge oberhalb von Falls Objekt ein steuere Babyphone mit wahr ein. Und versuche es nochmal. Bis dato funktioniert das Script nicht wenn der Datenpunkt auf unwahr steht.

                        1 Reply Last reply Reply Quote 0
                        • M
                          Michi 0 last edited by

                          Würde dann nicht bei jeder Trigger-Mail das Skript durchlaufen und den Status sofort auf "wahr" setzen? Damit würde doch gleich die nächste Pushmail versendet ohne die 5 Minuten abzuwarten...?

                          Jetzt habe ich nochmal auf der CCU und ioBroker nachgeprüft und den Status auch manuell auf wahr gesetzt. Läuft aber immer noch nicht. Ich glaub ich geh jetzt erst mal ne Runde an die Frische Luft. Sonst fliegt hier nur in Kürze irgendwas aus dem Fenster ☠

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

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          430
                          Online

                          32.0k
                          Users

                          80.4k
                          Topics

                          1.3m
                          Posts

                          blockly
                          2
                          11
                          335
                          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