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. [Frage BLOCKLY ] Klingel Bild per Telegram versenden / Snapshot von Cam per Telegram versenden

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.9k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    2.3k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    16
    1
    3.5k

[Frage BLOCKLY ] Klingel Bild per Telegram versenden / Snapshot von Cam per Telegram versenden

Geplant Angeheftet Gesperrt Verschoben Blockly
157 Beiträge 36 Kommentatoren 46.8k Aufrufe 31 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.
  • ? Ein ehemaliger Benutzer

    Zuerst habe ich per SSH einen Ordner angelegt:

    mkdir /opt/iobroker/ipcam
    

    Man muss dir URL der Kamera für das Bild heraus finden. Hier findet man einige Angaben https://www.ispyconnect.com/sources.aspx

    Wenn man die URL hat testet man diese im Browser ob dort das Bild aufgerufen wird. In meinen Fall sieht die URL so aus:

    http://benutzer:passwort@192.168.0.55/Streaming/channels/1/picture
    

    Hat man das Bild geöffnet und es hat funktioniert zurück perr SSH zum iobroker PC und gibt ein:

    wget --output-document /opt/iobroker/ipcam/alarm.jpg 'http://benutzer:passwort@192.168.0.55/Streaming/channels/1/picture' 
    

    Das Bild wird im Ordner gespeichert mit dem Namen alarm.jpg und dieses kann man per Telegram versenden.

    In den Einstellungen der javascript Instanz habe ich bei Erlaube das Kommando "exec" den Hacken gesetzt.

    Ich hoffe ich habe es richtig erklärt und man kann es auch verstehen. Bin nicht so der Profi im skripten..

    Blockly im Spoiler als Beispiel:

     <xml xmlns="http://www.w3.org/1999/xhtml"><block type="on_ext" id="jj8??y8i*v{!Fb0^jZ!*" x="-438" y="-262"><mutation items="1"></mutation>
        <field name="CONDITION">ne</field>
    
        <value name="OID0"><shadow type="field_oid" id="XEKh|+XF~3OC@EHY5{8{"><field name="oid">mihome.0.devices.sensor_motion_aq2_158d0001e514d4.state</field></shadow></value> 
        <statement name="STATEMENT"><block type="controls_if" id="xXlCTj)t?n*Gg:j44f#Y"><value name="IF0"><block type="logic_compare" id="pMPW|b)g/=L3!yP`vsW6"><field name="OP">EQ</field>
                <value name="A"><block type="get_value" id="5c7%aB|)K}(rNJ)#Jzd1"><field name="ATTR">val</field>
                    <field name="OID">mihome.0.devices.sensor_motion_aq2_158d0001e514d4.state</field></block></value> 
                <value name="B"><block type="logic_boolean" id="Lhj]yTw*W`/`leEqri.g"><field name="BOOL">TRUE</field></block></value></block></value> 
            <statement name="DO0"><block type="comment" id="eogMqz*f:xk9TWEY/!4#"><field name="COMMENT">Speichert das erste Bild bei Erkennung einer Bewegung</field>
                <next><block type="exec" id="BEjD=u,#e-;T;d-e9D;r"><mutation with_statement="false"></mutation>
                    <field name="WITH_STATEMENT">FALSE</field>
    
                    <value name="COMMAND"><shadow type="text" id="p+g^=?Sl15wP.0/4C~~B"><field name="TEXT">wget --output-document /opt/iobroker/ipcam/alarm.jpg 'http://benutzer:passwort@192.168.0.55/Streaming/channels/1/picture'</field></shadow></value> 
                    <next><block type="comment" id="qm0bnl/,Dq4PjA`4!8ao"><field name="COMMENT">Es wird 2500ms gewartet um dieses speichern auszuführen</field>
                        <next><block type="timeouts_settimeout" id="e=c#~E)j;S+#onaowS77"><field name="NAME">timeout</field>
                            <field name="DELAY">2500</field>
                            <field name="UNIT">ms</field>
                            <statement name="STATEMENT"><block type="comment" id="cLfsL/.hZGyA%n?O!-:5"><field name="COMMENT">Und hier wird es versendet</field>
                                <next><block type="telegram" id="FbkrL,IGK%]5xBi#Yj,="><field name="INSTANCE">.0</field>
    
                                    <value name="MESSAGE"><shadow type="text" id="wXLWD;.*8||`3_5J8(UB"><field name="TEXT">/opt/iobroker/ipcam/alarm.jpg</field></shadow></value></block></next></block></statement> 
                            <next><block type="comment" id="Fu=MNqw/7gDC_n{i|=UN"><field name="COMMENT">Nach dem ersten Bild wird nach 4000ms das nächste Bild gespeichert</field>
                                <next><block type="timeouts_settimeout" id="f55+L@!5F9d*i7)8.z}-"><field name="NAME">timeout2</field>
                                    <field name="DELAY">4000</field>
                                    <field name="UNIT">ms</field>
                                    <statement name="STATEMENT"><block type="exec" id="d~FCu]aLbH_s[eN3oB3H"><mutation with_statement="false"></mutation>
                                        <field name="WITH_STATEMENT">FALSE</field>
    
                                        <value name="COMMAND"><shadow type="text" id="q^pJl9(1bxjm4FLFJFlT"><field name="TEXT">wget --output-document /opt/iobroker/ipcam/alarm.jpg 'http://benutzer:passwort@192.168.0.55/Streaming/channels/1/picture'</field></shadow></value> 
                                        <next><block type="comment" id="KW^QIsb%Axd:Sp^9@vZ%"><field name="COMMENT">Es wird 2500ms gewartet um dieses speichern auszuführen</field>
                                            <next><block type="timeouts_settimeout" id="kqLD0XWHPVb*R%96uP;%"><field name="NAME">timeout3</field>
                                                <field name="DELAY">2500</field>
                                                <field name="UNIT">ms</field>
                                                <statement name="STATEMENT"><block type="comment" id="Vo3{l~+:~RYcTronq]q*"><field name="COMMENT">Und hier wird es versendet</field>
                                                    <next><block type="telegram" id="3p`vo?Dq*N;FLI4BR{`q"><field name="INSTANCE">.0</field>
    
                                                        <value name="MESSAGE"><shadow type="text" id="GsAgr]aq}s-1MR0mg|-W"><field name="TEXT">/opt/iobroker/ipcam/alarm.jpg</field></shadow></value></block></next></block></statement></block></next></block></next></block></statement> 
                                    <next><block type="comment" id="ma^~d4aFY-ahr*7)hhQy"><field name="COMMENT">ab hier so oft wiederholen wie man es möchte</field></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block></statement></block></xml> 
    
    E Offline
    E Offline
    eMd
    schrieb am zuletzt editiert von eMd
    #47

    @Brainbug

    Hallo,

    ich habe alles so gemacht wie du, Bild wird auch aktualisiert wenn ich per ssh den Befehl ausführe.

    Leider funktioniert es nicht per blockly, er schickt mir immer das alte...

    Idee woran das liegen könnte? Im log habe ich keinerlei Meldungen stehen...

    PS: chmod 777 war mein Fehler, hat sich erledigt

    Master: Intel NUC 16GB/500GB
    Slave: Raspberry Pi 3 + Homematicmodul
    Shelly, Google Home, Zigbee Aqara, Sonoff

    Meine VIS: https://youtu.be/JMYr2KYlpME

    1 Antwort Letzte Antwort
    0
    • ? Ein ehemaliger Benutzer

      Zuerst habe ich per SSH einen Ordner angelegt:

      mkdir /opt/iobroker/ipcam
      

      Man muss dir URL der Kamera für das Bild heraus finden. Hier findet man einige Angaben https://www.ispyconnect.com/sources.aspx

      Wenn man die URL hat testet man diese im Browser ob dort das Bild aufgerufen wird. In meinen Fall sieht die URL so aus:

      http://benutzer:passwort@192.168.0.55/Streaming/channels/1/picture
      

      Hat man das Bild geöffnet und es hat funktioniert zurück perr SSH zum iobroker PC und gibt ein:

      wget --output-document /opt/iobroker/ipcam/alarm.jpg 'http://benutzer:passwort@192.168.0.55/Streaming/channels/1/picture' 
      

      Das Bild wird im Ordner gespeichert mit dem Namen alarm.jpg und dieses kann man per Telegram versenden.

      In den Einstellungen der javascript Instanz habe ich bei Erlaube das Kommando "exec" den Hacken gesetzt.

      Ich hoffe ich habe es richtig erklärt und man kann es auch verstehen. Bin nicht so der Profi im skripten..

      Blockly im Spoiler als Beispiel:

       <xml xmlns="http://www.w3.org/1999/xhtml"><block type="on_ext" id="jj8??y8i*v{!Fb0^jZ!*" x="-438" y="-262"><mutation items="1"></mutation>
          <field name="CONDITION">ne</field>
      
          <value name="OID0"><shadow type="field_oid" id="XEKh|+XF~3OC@EHY5{8{"><field name="oid">mihome.0.devices.sensor_motion_aq2_158d0001e514d4.state</field></shadow></value> 
          <statement name="STATEMENT"><block type="controls_if" id="xXlCTj)t?n*Gg:j44f#Y"><value name="IF0"><block type="logic_compare" id="pMPW|b)g/=L3!yP`vsW6"><field name="OP">EQ</field>
                  <value name="A"><block type="get_value" id="5c7%aB|)K}(rNJ)#Jzd1"><field name="ATTR">val</field>
                      <field name="OID">mihome.0.devices.sensor_motion_aq2_158d0001e514d4.state</field></block></value> 
                  <value name="B"><block type="logic_boolean" id="Lhj]yTw*W`/`leEqri.g"><field name="BOOL">TRUE</field></block></value></block></value> 
              <statement name="DO0"><block type="comment" id="eogMqz*f:xk9TWEY/!4#"><field name="COMMENT">Speichert das erste Bild bei Erkennung einer Bewegung</field>
                  <next><block type="exec" id="BEjD=u,#e-;T;d-e9D;r"><mutation with_statement="false"></mutation>
                      <field name="WITH_STATEMENT">FALSE</field>
      
                      <value name="COMMAND"><shadow type="text" id="p+g^=?Sl15wP.0/4C~~B"><field name="TEXT">wget --output-document /opt/iobroker/ipcam/alarm.jpg 'http://benutzer:passwort@192.168.0.55/Streaming/channels/1/picture'</field></shadow></value> 
                      <next><block type="comment" id="qm0bnl/,Dq4PjA`4!8ao"><field name="COMMENT">Es wird 2500ms gewartet um dieses speichern auszuführen</field>
                          <next><block type="timeouts_settimeout" id="e=c#~E)j;S+#onaowS77"><field name="NAME">timeout</field>
                              <field name="DELAY">2500</field>
                              <field name="UNIT">ms</field>
                              <statement name="STATEMENT"><block type="comment" id="cLfsL/.hZGyA%n?O!-:5"><field name="COMMENT">Und hier wird es versendet</field>
                                  <next><block type="telegram" id="FbkrL,IGK%]5xBi#Yj,="><field name="INSTANCE">.0</field>
      
                                      <value name="MESSAGE"><shadow type="text" id="wXLWD;.*8||`3_5J8(UB"><field name="TEXT">/opt/iobroker/ipcam/alarm.jpg</field></shadow></value></block></next></block></statement> 
                              <next><block type="comment" id="Fu=MNqw/7gDC_n{i|=UN"><field name="COMMENT">Nach dem ersten Bild wird nach 4000ms das nächste Bild gespeichert</field>
                                  <next><block type="timeouts_settimeout" id="f55+L@!5F9d*i7)8.z}-"><field name="NAME">timeout2</field>
                                      <field name="DELAY">4000</field>
                                      <field name="UNIT">ms</field>
                                      <statement name="STATEMENT"><block type="exec" id="d~FCu]aLbH_s[eN3oB3H"><mutation with_statement="false"></mutation>
                                          <field name="WITH_STATEMENT">FALSE</field>
      
                                          <value name="COMMAND"><shadow type="text" id="q^pJl9(1bxjm4FLFJFlT"><field name="TEXT">wget --output-document /opt/iobroker/ipcam/alarm.jpg 'http://benutzer:passwort@192.168.0.55/Streaming/channels/1/picture'</field></shadow></value> 
                                          <next><block type="comment" id="KW^QIsb%Axd:Sp^9@vZ%"><field name="COMMENT">Es wird 2500ms gewartet um dieses speichern auszuführen</field>
                                              <next><block type="timeouts_settimeout" id="kqLD0XWHPVb*R%96uP;%"><field name="NAME">timeout3</field>
                                                  <field name="DELAY">2500</field>
                                                  <field name="UNIT">ms</field>
                                                  <statement name="STATEMENT"><block type="comment" id="Vo3{l~+:~RYcTronq]q*"><field name="COMMENT">Und hier wird es versendet</field>
                                                      <next><block type="telegram" id="3p`vo?Dq*N;FLI4BR{`q"><field name="INSTANCE">.0</field>
      
                                                          <value name="MESSAGE"><shadow type="text" id="GsAgr]aq}s-1MR0mg|-W"><field name="TEXT">/opt/iobroker/ipcam/alarm.jpg</field></shadow></value></block></next></block></statement></block></next></block></next></block></statement> 
                                      <next><block type="comment" id="ma^~d4aFY-ahr*7)hhQy"><field name="COMMENT">ab hier so oft wiederholen wie man es möchte</field></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block></statement></block></xml> 
      
      D Offline
      D Offline
      davimas
      schrieb am zuletzt editiert von
      #48

      @Brainbug said in [Frage BLOCKLY ] Klingel Bild per Telegram versenden / Snapshot von Cam per Telegram versenden:

      <xml xmlns="http://www.w3.org/1999/xhtml"><block type="on_ext" id="jj8??y8iv{!Fb0^jZ!" x="-438" y="-262"><mutation items="1"></mutation>
      <field name="CONDITION">ne</field>
      

      Hey, bekomme beim Import versuch diese Fehlermeldung: TypeError: Blockly.Xml.textToDom expected an <xml> document.

      dslraserD 1 Antwort Letzte Antwort
      0
      • D davimas

        @Brainbug said in [Frage BLOCKLY ] Klingel Bild per Telegram versenden / Snapshot von Cam per Telegram versenden:

        <xml xmlns="http://www.w3.org/1999/xhtml"><block type="on_ext" id="jj8??y8iv{!Fb0^jZ!" x="-438" y="-262"><mutation items="1"></mutation>
        <field name="CONDITION">ne</field>
        

        Hey, bekomme beim Import versuch diese Fehlermeldung: TypeError: Blockly.Xml.textToDom expected an <xml> document.

        dslraserD Offline
        dslraserD Offline
        dslraser
        Forum Testing Most Active
        schrieb am zuletzt editiert von
        #49

        @davimas
        Der von Dir verlinkte Beitrag ist wohl bei der Forumumstellung kaputt gegangen, das Blockly steht da in zwei teilen. Ich habe das mal zusammen kopiert und dann importiert, dabei kommt dann das hier raus:

        <xml xmlns="http://www.w3.org/1999/xhtml">
         <variables>
           <variable type="undefined" id="timeout">timeout</variable>
           <variable type="undefined" id="timeout2">timeout2</variable>
           <variable type="undefined" id="timeout3">timeout3</variable>
         </variables>
         <block type="on_ext" id="jj8??y8iv{!Fb0^jZ!" x="-438" y="-262">
           <mutation items="1"></mutation>
           <field name="CONDITION">ne</field>
           <field name="ACK_CONDITION"></field>
           <value name="OID0">
             <shadow type="field_oid" id="XEKh|+XF~3OC@EHY5{8{">
               <field name="oid">mihome.0.devices.sensor_motion_aq2_158d0001e514d4.state</field>
             </shadow>
           </value>
           <statement name="STATEMENT">
             <block type="controls_if" id="xXlCTj)t?n*Gg:j44f#Y">
               <value name="IF0">
                 <block type="logic_compare" id="pMPW|b)g/=L3!yP`vsW6">
                   <field name="OP">EQ</field>
                   <value name="A">
                     <block type="get_value" id="5c7%aB|)K}(rNJ)#Jzd1">
                       <field name="ATTR">val</field>
                       <field name="OID">mihome.0.devices.sensor_motion_aq2_158d0001e514d4.state</field>
                     </block>
                   </value>
                   <value name="B">
                     <block type="logic_boolean" id="Lhj]yTw*W`/`leEqri.g">
                       <field name="BOOL">TRUE</field>
                     </block>
                   </value>
                 </block>
               </value>
               <statement name="DO0">
                 <block type="comment" id="eogMqz*f:xk9TWEY/!4#">
                   <field name="COMMENT">Speichert das erste Bild bei Erkennung einer Bewegung</field>
                   <next>
                     <block type="exec" id="BEjD=u,#e-;T;d-e9D;r">
                       <mutation with_statement="false"></mutation>
                       <field name="WITH_STATEMENT">FALSE</field>
                       <field name="LOG"></field>
                       <value name="COMMAND">
                         <shadow type="text" id="p+g^=?Sl15wP.0/4C~~B">
                           <field name="TEXT">wget --output-document /opt/iobroker/ipcam/alarm.jpg 'http://benutzer:passwort@192.168.0.55/Streaming/channels/1/picture'</field>
                         </shadow>
                       </value>
                       <next>
                         <block type="comment" id="qm0bnl/,Dq4PjA`4!8ao">
                           <field name="COMMENT">Es wird 2500ms gewartet um dieses speichern auszuführen</field>
                           <next>
                             <block type="timeouts_settimeout" id="e=c#~E)j;S+#onaowS77">
                               <field name="NAME">timeout</field>
                               <field name="DELAY">2500</field>
                               <field name="UNIT">ms</field>
                               <statement name="STATEMENT">
                                 <block type="comment" id="cLfsL/.hZGyA%n?O!-:5">
                                   <field name="COMMENT">Und hier wird es versendet</field>
                                   <next>
                                     <block type="telegram" id="FbkrL,IGK%]5xBi#Yj,=">
                                       <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="wXLWD;.*8||`3_5J8(UB">
                                           <field name="TEXT">/opt/iobroker/ipcam/alarm.jpg</field>
                                         </shadow>
                                       </value>
                                     </block>
                                   </next>
                                 </block>
                               </statement>
                               <next>
                                 <block type="comment" id="Fu=MNqw/7gDC_n{i|=UN">
                                   <field name="COMMENT">Nach dem ersten Bild wird nach 4000ms das nächste Bild gespeichert</field>
                                   <next>
                                     <block type="timeouts_settimeout" id="f55+L@!5F9d*i7)8.z}-">
                                       <field name="NAME">timeout2</field>
                                       <field name="DELAY">4000</field>
                                       <field name="UNIT">ms</field>
                                       <statement name="STATEMENT">
                                         <block type="exec" id="d~FCu]aLbH_s[eN3oB3H">
                                           <mutation with_statement="false"></mutation>
                                           <field name="WITH_STATEMENT">FALSE</field>
                                           <field name="LOG"></field>
                                           <value name="COMMAND">
                                             <shadow type="text" id="q^pJl9(1bxjm4FLFJFlT">
                                               <field name="TEXT">wget --output-document /opt/iobroker/ipcam/alarm.jpg 'http://benutzer:passwort@192.168.0.55/Streaming/channels/1/picture'</field>
                                             </shadow>
                                           </value>
                                           <next>
                                             <block type="comment" id="KW^QIsb%Axd:Sp^9@vZ%">
                                               <field name="COMMENT">Es wird 2500ms gewartet um dieses speichern auszuführen</field>
                                               <next>
                                                 <block type="timeouts_settimeout" id="kqLD0XWHPVb*R%96uP;%">
                                                   <field name="NAME">timeout3</field>
                                                   <field name="DELAY">2500</field>
                                                   <field name="UNIT">ms</field>
                                                   <statement name="STATEMENT">
                                                     <block type="comment" id="Vo3{l~+:~RYcTronq]q*">
                                                       <field name="COMMENT">Und hier wird es versendet</field>
                                                       <next>
                                                         <block type="telegram" id="3p`vo?Dq*N;FLI4BR{`q">
                                                           <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="GsAgr]aq}s-1MR0mg|-W">
                                                               <field name="TEXT">/opt/iobroker/ipcam/alarm.jpg</field>
                                                             </shadow>
                                                           </value>
                                                         </block>
                                                       </next>
                                                     </block>
                                                   </statement>
                                                 </block>
                                               </next>
                                             </block>
                                           </next>
                                         </block>
                                       </statement>
                                       <next>
                                         <block type="comment" id="ma^~d4aFY-ahr*7)hhQy">
                                           <field name="COMMENT">ab hier so oft wiederholen wie man es möchte</field>
                                         </block>
                                       </next>
                                     </block>
                                   </next>
                                 </block>
                               </next>
                             </block>
                           </next>
                         </block>
                       </next>
                     </block>
                   </next>
                 </block>
               </statement>
             </block>
           </statement>
         </block>
        </xml>
        

        D 1 Antwort Letzte Antwort
        0
        • dslraserD dslraser

          @davimas
          Der von Dir verlinkte Beitrag ist wohl bei der Forumumstellung kaputt gegangen, das Blockly steht da in zwei teilen. Ich habe das mal zusammen kopiert und dann importiert, dabei kommt dann das hier raus:

          <xml xmlns="http://www.w3.org/1999/xhtml">
           <variables>
             <variable type="undefined" id="timeout">timeout</variable>
             <variable type="undefined" id="timeout2">timeout2</variable>
             <variable type="undefined" id="timeout3">timeout3</variable>
           </variables>
           <block type="on_ext" id="jj8??y8iv{!Fb0^jZ!" x="-438" y="-262">
             <mutation items="1"></mutation>
             <field name="CONDITION">ne</field>
             <field name="ACK_CONDITION"></field>
             <value name="OID0">
               <shadow type="field_oid" id="XEKh|+XF~3OC@EHY5{8{">
                 <field name="oid">mihome.0.devices.sensor_motion_aq2_158d0001e514d4.state</field>
               </shadow>
             </value>
             <statement name="STATEMENT">
               <block type="controls_if" id="xXlCTj)t?n*Gg:j44f#Y">
                 <value name="IF0">
                   <block type="logic_compare" id="pMPW|b)g/=L3!yP`vsW6">
                     <field name="OP">EQ</field>
                     <value name="A">
                       <block type="get_value" id="5c7%aB|)K}(rNJ)#Jzd1">
                         <field name="ATTR">val</field>
                         <field name="OID">mihome.0.devices.sensor_motion_aq2_158d0001e514d4.state</field>
                       </block>
                     </value>
                     <value name="B">
                       <block type="logic_boolean" id="Lhj]yTw*W`/`leEqri.g">
                         <field name="BOOL">TRUE</field>
                       </block>
                     </value>
                   </block>
                 </value>
                 <statement name="DO0">
                   <block type="comment" id="eogMqz*f:xk9TWEY/!4#">
                     <field name="COMMENT">Speichert das erste Bild bei Erkennung einer Bewegung</field>
                     <next>
                       <block type="exec" id="BEjD=u,#e-;T;d-e9D;r">
                         <mutation with_statement="false"></mutation>
                         <field name="WITH_STATEMENT">FALSE</field>
                         <field name="LOG"></field>
                         <value name="COMMAND">
                           <shadow type="text" id="p+g^=?Sl15wP.0/4C~~B">
                             <field name="TEXT">wget --output-document /opt/iobroker/ipcam/alarm.jpg 'http://benutzer:passwort@192.168.0.55/Streaming/channels/1/picture'</field>
                           </shadow>
                         </value>
                         <next>
                           <block type="comment" id="qm0bnl/,Dq4PjA`4!8ao">
                             <field name="COMMENT">Es wird 2500ms gewartet um dieses speichern auszuführen</field>
                             <next>
                               <block type="timeouts_settimeout" id="e=c#~E)j;S+#onaowS77">
                                 <field name="NAME">timeout</field>
                                 <field name="DELAY">2500</field>
                                 <field name="UNIT">ms</field>
                                 <statement name="STATEMENT">
                                   <block type="comment" id="cLfsL/.hZGyA%n?O!-:5">
                                     <field name="COMMENT">Und hier wird es versendet</field>
                                     <next>
                                       <block type="telegram" id="FbkrL,IGK%]5xBi#Yj,=">
                                         <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="wXLWD;.*8||`3_5J8(UB">
                                             <field name="TEXT">/opt/iobroker/ipcam/alarm.jpg</field>
                                           </shadow>
                                         </value>
                                       </block>
                                     </next>
                                   </block>
                                 </statement>
                                 <next>
                                   <block type="comment" id="Fu=MNqw/7gDC_n{i|=UN">
                                     <field name="COMMENT">Nach dem ersten Bild wird nach 4000ms das nächste Bild gespeichert</field>
                                     <next>
                                       <block type="timeouts_settimeout" id="f55+L@!5F9d*i7)8.z}-">
                                         <field name="NAME">timeout2</field>
                                         <field name="DELAY">4000</field>
                                         <field name="UNIT">ms</field>
                                         <statement name="STATEMENT">
                                           <block type="exec" id="d~FCu]aLbH_s[eN3oB3H">
                                             <mutation with_statement="false"></mutation>
                                             <field name="WITH_STATEMENT">FALSE</field>
                                             <field name="LOG"></field>
                                             <value name="COMMAND">
                                               <shadow type="text" id="q^pJl9(1bxjm4FLFJFlT">
                                                 <field name="TEXT">wget --output-document /opt/iobroker/ipcam/alarm.jpg 'http://benutzer:passwort@192.168.0.55/Streaming/channels/1/picture'</field>
                                               </shadow>
                                             </value>
                                             <next>
                                               <block type="comment" id="KW^QIsb%Axd:Sp^9@vZ%">
                                                 <field name="COMMENT">Es wird 2500ms gewartet um dieses speichern auszuführen</field>
                                                 <next>
                                                   <block type="timeouts_settimeout" id="kqLD0XWHPVb*R%96uP;%">
                                                     <field name="NAME">timeout3</field>
                                                     <field name="DELAY">2500</field>
                                                     <field name="UNIT">ms</field>
                                                     <statement name="STATEMENT">
                                                       <block type="comment" id="Vo3{l~+:~RYcTronq]q*">
                                                         <field name="COMMENT">Und hier wird es versendet</field>
                                                         <next>
                                                           <block type="telegram" id="3p`vo?Dq*N;FLI4BR{`q">
                                                             <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="GsAgr]aq}s-1MR0mg|-W">
                                                                 <field name="TEXT">/opt/iobroker/ipcam/alarm.jpg</field>
                                                               </shadow>
                                                             </value>
                                                           </block>
                                                         </next>
                                                       </block>
                                                     </statement>
                                                   </block>
                                                 </next>
                                               </block>
                                             </next>
                                           </block>
                                         </statement>
                                         <next>
                                           <block type="comment" id="ma^~d4aFY-ahr*7)hhQy">
                                             <field name="COMMENT">ab hier so oft wiederholen wie man es möchte</field>
                                           </block>
                                         </next>
                                       </block>
                                     </next>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </next>
                   </block>
                 </statement>
               </block>
             </statement>
           </block>
          </xml>
          

          D Offline
          D Offline
          davimas
          schrieb am zuletzt editiert von davimas
          #50

          @dslraser

          Danke Dir.
          Arbeite mich da erst vor kurzem rein, in Blockly und sehe erst jetzt dass der "Aufbau" des Textes passen muss. Gerade eben erfolgreich deinen Fensterzählscript mit Telegramm eingebunden und auf meine Installation abgeändert :+1:
          Ist echt einfacher als Javascripts :-))

          1 Antwort Letzte Antwort
          0
          • R Offline
            R Offline
            Roelli
            schrieb am zuletzt editiert von
            #51

            Nabend!

            Also ein GIF von der Kamera ist echt bisher das geilste was im Bereich Smarthome gesehen habe. (besser als Push-Nachrichten und emails von Fotos auf's Handy)

            Aber ich bekomme es nicht stabil hin.
            ffmpeg hab ich installiert, ich kann auch einwandfrei ein Bild erzeugen. Aber nur EIN mal. Wenn ich danach den gleichen Befehl wieder abrufe - dann kommt kein Bild. (nur ein Gif ohne Bild, aber mit richtiger Uhrzeit drin)

            Ich komme einfach nicht drauf was das Problem ist. Jemand eine Idee?
            (Telegram-Nachricht habe ich 1000mS verzögert damit ffmpeg Zeit hat das GIF zu erzeugen)

            Danke!

            NUC6i7KYK M.2 32GB RAM mit Proxmox
            14 AccessPoints, 5 Switches 115 Adapter, 67913 Objekte, 57954 Zustände,126x Shelly, 26 Thermostate, Fire Tablets, DMX, USV, 18x echodot, 9xKlima, 4x heizung, beamer, 6x IP Speed dome, AiOnTheEdge, Tasmota Wemos, Fingerabdrucksensoren, VOIP TFE, Türsteuerung, BMZ,EMA

            1 Antwort Letzte Antwort
            0
            • KnallochseK Offline
              KnallochseK Offline
              Knallochse
              schrieb am zuletzt editiert von
              #52

              @Uhula Ich habe dein Script gerade ausprobiert. Die Bilder lasse ich mir unter Vis.0 in Unterordnern abspeichern (welche ich mit dem Vis Editor erzeugt habe - wegen Rechte).
              Diese Snapshots werden auch erzeugt. Nur leider kann ich mit dem Widget basicImage keine der Snapshots auswählen (Ordner wird leer angezeigt)
              Eine Idee wie ich die Snapshots in meine Vis bekomme?

              HM&HMIP über 100 Geräte + IoBroker auf DS918+ uvm.

              crunchipC 1 Antwort Letzte Antwort
              0
              • KnallochseK Knallochse

                @Uhula Ich habe dein Script gerade ausprobiert. Die Bilder lasse ich mir unter Vis.0 in Unterordnern abspeichern (welche ich mit dem Vis Editor erzeugt habe - wegen Rechte).
                Diese Snapshots werden auch erzeugt. Nur leider kann ich mit dem Widget basicImage keine der Snapshots auswählen (Ordner wird leer angezeigt)
                Eine Idee wie ich die Snapshots in meine Vis bekomme?

                crunchipC Offline
                crunchipC Offline
                crunchip
                Forum Testing Most Active
                schrieb am zuletzt editiert von
                #53

                @Knallochse das geht nicht mehr siehe https://forum.iobroker.net/post/309472
                siehe auch hier https://forum.iobroker.net/topic/25541/gelöst-wie-writefile-in-js-script-nutzen
                vllt kannst du dieses gebrauchen https://forum.iobroker.net/post/349575

                umgestiegen von Proxmox auf Unraid

                KnallochseK 1 Antwort Letzte Antwort
                1
                • crunchipC crunchip

                  @Knallochse das geht nicht mehr siehe https://forum.iobroker.net/post/309472
                  siehe auch hier https://forum.iobroker.net/topic/25541/gelöst-wie-writefile-in-js-script-nutzen
                  vllt kannst du dieses gebrauchen https://forum.iobroker.net/post/349575

                  KnallochseK Offline
                  KnallochseK Offline
                  Knallochse
                  schrieb am zuletzt editiert von
                  #54

                  @crunchip Dankeschön 👍

                  HM&HMIP über 100 Geräte + IoBroker auf DS918+ uvm.

                  1 Antwort Letzte Antwort
                  0
                  • KnallochseK Offline
                    KnallochseK Offline
                    Knallochse
                    schrieb am zuletzt editiert von
                    #55

                    Ich habe mich jetzt mal in die Problematik mit dem Speichern von Bildern reingelesen.
                    Eigentlich sollte das speichern in den Vis.0 Ordner ja noch funktionieren.
                    Ich habe aber keine Programmierkenntnisse, deshalb die Bitte ob mir bitte jemand bei dem Umschreiben des Scriptes von @Uhula helfen könnte.

                    // -------------------------------------------------------------------------
                    // Dieses Script überwaht den Zustand eines Bewegungsmelders und speichert bei
                    // Aktivierung ein Bild einer Überwachnungskamera in einem Vereichnis und sendet
                    // dieses via Telegram.0-Adapter. Nach 10 Sek wird ein weiteres Bild erstellt und
                    // gesendet.
                    // Die Speicherung der Bilder erfolgt als "Stack", d.h. das aktuellste Bild bekommt
                    // immer den Suffix "0" und es werden n Bilder mit den Suffixen 1..n-1 vorgehalten
                    // Uhula 2017.11
                    // -------------------------------------------------------------------------
                    // -------------------------------------------------------------------------
                    // Konfiguration
                    // -------------------------------------------------------------------------
                       // Objekt-ID des Bewegungsmelders
                    const oidLichtBewmelderTuer = "shelly.0.SHSW-1#2C6E3A#1.Relay0.Switch";
                       // URL zur Kamera umn ein Image (jpg) zu erhalten
                    const cam_url = "http://admin:XXXXXXXX@192.168.178.51:80/tmpfs/auto.jpg";
                       // Pfadangabe für die Speicherung der Bilder, der Pfad muss existieren
                    const dest_path = '/opt/iobroker/iobroker-data/files/vis.0/Kameras/ParkplatzStrasse/';
                       // Anzahl der Bilder, die vorgehalten werden sollen
                    const imageCountMax = 8;                
                       // Prefix für die Bildnamen
                    const imageNamePre = "ParkplatzStrasse_"; 
                    // -------------------------------------------------------------------------
                    // Scriptteil
                    // -------------------------------------------------------------------------
                    var request = require('request');
                    var fs      = require('fs');
                    // Bild an telegram schicken 
                    //function sendImage (path) { 
                        //try {
                            //var stats = fs.statSync(path);
                            //var msg = formatDate(stats.birthtime,"DD.MM.YYYY hh:mm:ss") + " " + path.substring(path.lastIndexOf('/')+1);
                            //sendTo('telegram.0', {
                                //text:                   path,
                                //caption:                msg, 
                                //disable_notification:   true
                            //});
                        //}
                        //catch(err) { if (err.code != "ENOENT") log(err); }     
                    //}
                    // löscht eine Datei synchron (wartet auf das Ergebnis)
                    function fsUnlinkSync(path) {
                        try {
                            var stats = fs.statSync(path);
                            try { fs.unlinkSync(path); }
                            catch(err) { if (err.code != "ENOENT") log(err); }     
                        }
                        catch(err) { if (err.code != "ENOENT") log(err); }
                    }
                    // benennt eine Datei synchron um (wartet auf das Ergebnis)
                    function fsRenameSync(oldPath, newPath) {
                        try {
                            var stats = fs.statSync(oldPath);
                            try { fs.renameSync(oldPath, newPath); }
                            catch(err) { if (err.code != "ENOENT") log(err); }     
                        }
                        catch(err) { if (err.code != "ENOENT") log(err); }
                    }
                    // Bild speichern und senden
                    function saveImage() {
                        // Bild imageCountMax-1 löschen
                        fsUnlinkSync( dest_path + imageNamePre + (imageCountMax-1) + ".jpg" );
                        // Bilder 0..imageCountMax-2 umbenennen
                        for (var i=imageCountMax-2; i >= 0; i-- ) { 
                            fsRenameSync(dest_path + imageNamePre + i + ".jpg", dest_path + imageNamePre + (i+1) + ".jpg"); 
                        }
                        // Bild 0 löschen
                        var fname = imageNamePre + "0.jpg";
                        fsUnlinkSync( fname );
                        // Bild holen und speichern
                        request.get({url: cam_url, encoding: 'binary'}, function (err, response, body) {
                            fs.writeFile(dest_path + fname, body, 'binary', function(err) {
                                if (err) {
                                    log('Fehler beim Bild speichern: ' + err, 'warn');
                                } else {
                                    // dem Filesystem 2 Sek Zeit zum Speichern lassen
                                    //setTimeout(function() { sendImage(dest_path + fname); }, 2000); 
                                }
                            }); 
                        });
                    }
                    // sofort ein Bild senden und nach 8 Sek erneut
                    function onEvent() {
                        saveImage();
                        setTimeout(function() { saveImage(); }, 8 * 1000); 
                    }
                    // Ereignisroutine
                    on({id: oidLichtBewmelderTuer, val: true}, function (obj) {
                        onEvent( obj );
                    });
                    // manuelle Ausführung (Test)
                    onEvent();
                    
                    

                    HM&HMIP über 100 Geräte + IoBroker auf DS918+ uvm.

                    crunchipC GlasfaserG 2 Antworten Letzte Antwort
                    0
                    • KnallochseK Knallochse

                      Ich habe mich jetzt mal in die Problematik mit dem Speichern von Bildern reingelesen.
                      Eigentlich sollte das speichern in den Vis.0 Ordner ja noch funktionieren.
                      Ich habe aber keine Programmierkenntnisse, deshalb die Bitte ob mir bitte jemand bei dem Umschreiben des Scriptes von @Uhula helfen könnte.

                      // -------------------------------------------------------------------------
                      // Dieses Script überwaht den Zustand eines Bewegungsmelders und speichert bei
                      // Aktivierung ein Bild einer Überwachnungskamera in einem Vereichnis und sendet
                      // dieses via Telegram.0-Adapter. Nach 10 Sek wird ein weiteres Bild erstellt und
                      // gesendet.
                      // Die Speicherung der Bilder erfolgt als "Stack", d.h. das aktuellste Bild bekommt
                      // immer den Suffix "0" und es werden n Bilder mit den Suffixen 1..n-1 vorgehalten
                      // Uhula 2017.11
                      // -------------------------------------------------------------------------
                      // -------------------------------------------------------------------------
                      // Konfiguration
                      // -------------------------------------------------------------------------
                         // Objekt-ID des Bewegungsmelders
                      const oidLichtBewmelderTuer = "shelly.0.SHSW-1#2C6E3A#1.Relay0.Switch";
                         // URL zur Kamera umn ein Image (jpg) zu erhalten
                      const cam_url = "http://admin:XXXXXXXX@192.168.178.51:80/tmpfs/auto.jpg";
                         // Pfadangabe für die Speicherung der Bilder, der Pfad muss existieren
                      const dest_path = '/opt/iobroker/iobroker-data/files/vis.0/Kameras/ParkplatzStrasse/';
                         // Anzahl der Bilder, die vorgehalten werden sollen
                      const imageCountMax = 8;                
                         // Prefix für die Bildnamen
                      const imageNamePre = "ParkplatzStrasse_"; 
                      // -------------------------------------------------------------------------
                      // Scriptteil
                      // -------------------------------------------------------------------------
                      var request = require('request');
                      var fs      = require('fs');
                      // Bild an telegram schicken 
                      //function sendImage (path) { 
                          //try {
                              //var stats = fs.statSync(path);
                              //var msg = formatDate(stats.birthtime,"DD.MM.YYYY hh:mm:ss") + " " + path.substring(path.lastIndexOf('/')+1);
                              //sendTo('telegram.0', {
                                  //text:                   path,
                                  //caption:                msg, 
                                  //disable_notification:   true
                              //});
                          //}
                          //catch(err) { if (err.code != "ENOENT") log(err); }     
                      //}
                      // löscht eine Datei synchron (wartet auf das Ergebnis)
                      function fsUnlinkSync(path) {
                          try {
                              var stats = fs.statSync(path);
                              try { fs.unlinkSync(path); }
                              catch(err) { if (err.code != "ENOENT") log(err); }     
                          }
                          catch(err) { if (err.code != "ENOENT") log(err); }
                      }
                      // benennt eine Datei synchron um (wartet auf das Ergebnis)
                      function fsRenameSync(oldPath, newPath) {
                          try {
                              var stats = fs.statSync(oldPath);
                              try { fs.renameSync(oldPath, newPath); }
                              catch(err) { if (err.code != "ENOENT") log(err); }     
                          }
                          catch(err) { if (err.code != "ENOENT") log(err); }
                      }
                      // Bild speichern und senden
                      function saveImage() {
                          // Bild imageCountMax-1 löschen
                          fsUnlinkSync( dest_path + imageNamePre + (imageCountMax-1) + ".jpg" );
                          // Bilder 0..imageCountMax-2 umbenennen
                          for (var i=imageCountMax-2; i >= 0; i-- ) { 
                              fsRenameSync(dest_path + imageNamePre + i + ".jpg", dest_path + imageNamePre + (i+1) + ".jpg"); 
                          }
                          // Bild 0 löschen
                          var fname = imageNamePre + "0.jpg";
                          fsUnlinkSync( fname );
                          // Bild holen und speichern
                          request.get({url: cam_url, encoding: 'binary'}, function (err, response, body) {
                              fs.writeFile(dest_path + fname, body, 'binary', function(err) {
                                  if (err) {
                                      log('Fehler beim Bild speichern: ' + err, 'warn');
                                  } else {
                                      // dem Filesystem 2 Sek Zeit zum Speichern lassen
                                      //setTimeout(function() { sendImage(dest_path + fname); }, 2000); 
                                  }
                              }); 
                          });
                      }
                      // sofort ein Bild senden und nach 8 Sek erneut
                      function onEvent() {
                          saveImage();
                          setTimeout(function() { saveImage(); }, 8 * 1000); 
                      }
                      // Ereignisroutine
                      on({id: oidLichtBewmelderTuer, val: true}, function (obj) {
                          onEvent( obj );
                      });
                      // manuelle Ausführung (Test)
                      onEvent();
                      
                      
                      crunchipC Offline
                      crunchipC Offline
                      crunchip
                      Forum Testing Most Active
                      schrieb am zuletzt editiert von
                      #56

                      @Knallochse kann dir zwar nicht direkt behilflich sein. Jedoch kannst du auf die schnelle einfach ausserhalb von "/opt/iobroker/iobroker-data/files/vis.0/" deine Bilder ablegen. Also z.b. "/opt/iobroker/Kameras/"
                      Dann würde es normal funktionieren. Nachteil, ... BackitUp, da die Daten ausserhalb von ...data/files liegen, würden diese verloren gehn
                      Da ich, wenn mal nötig ein Backup mittels Proxmox zurück spiele, spielt es in meinem Fall keine Rolle.

                      umgestiegen von Proxmox auf Unraid

                      1 Antwort Letzte Antwort
                      0
                      • KnallochseK Knallochse

                        Ich habe mich jetzt mal in die Problematik mit dem Speichern von Bildern reingelesen.
                        Eigentlich sollte das speichern in den Vis.0 Ordner ja noch funktionieren.
                        Ich habe aber keine Programmierkenntnisse, deshalb die Bitte ob mir bitte jemand bei dem Umschreiben des Scriptes von @Uhula helfen könnte.

                        // -------------------------------------------------------------------------
                        // Dieses Script überwaht den Zustand eines Bewegungsmelders und speichert bei
                        // Aktivierung ein Bild einer Überwachnungskamera in einem Vereichnis und sendet
                        // dieses via Telegram.0-Adapter. Nach 10 Sek wird ein weiteres Bild erstellt und
                        // gesendet.
                        // Die Speicherung der Bilder erfolgt als "Stack", d.h. das aktuellste Bild bekommt
                        // immer den Suffix "0" und es werden n Bilder mit den Suffixen 1..n-1 vorgehalten
                        // Uhula 2017.11
                        // -------------------------------------------------------------------------
                        // -------------------------------------------------------------------------
                        // Konfiguration
                        // -------------------------------------------------------------------------
                           // Objekt-ID des Bewegungsmelders
                        const oidLichtBewmelderTuer = "shelly.0.SHSW-1#2C6E3A#1.Relay0.Switch";
                           // URL zur Kamera umn ein Image (jpg) zu erhalten
                        const cam_url = "http://admin:XXXXXXXX@192.168.178.51:80/tmpfs/auto.jpg";
                           // Pfadangabe für die Speicherung der Bilder, der Pfad muss existieren
                        const dest_path = '/opt/iobroker/iobroker-data/files/vis.0/Kameras/ParkplatzStrasse/';
                           // Anzahl der Bilder, die vorgehalten werden sollen
                        const imageCountMax = 8;                
                           // Prefix für die Bildnamen
                        const imageNamePre = "ParkplatzStrasse_"; 
                        // -------------------------------------------------------------------------
                        // Scriptteil
                        // -------------------------------------------------------------------------
                        var request = require('request');
                        var fs      = require('fs');
                        // Bild an telegram schicken 
                        //function sendImage (path) { 
                            //try {
                                //var stats = fs.statSync(path);
                                //var msg = formatDate(stats.birthtime,"DD.MM.YYYY hh:mm:ss") + " " + path.substring(path.lastIndexOf('/')+1);
                                //sendTo('telegram.0', {
                                    //text:                   path,
                                    //caption:                msg, 
                                    //disable_notification:   true
                                //});
                            //}
                            //catch(err) { if (err.code != "ENOENT") log(err); }     
                        //}
                        // löscht eine Datei synchron (wartet auf das Ergebnis)
                        function fsUnlinkSync(path) {
                            try {
                                var stats = fs.statSync(path);
                                try { fs.unlinkSync(path); }
                                catch(err) { if (err.code != "ENOENT") log(err); }     
                            }
                            catch(err) { if (err.code != "ENOENT") log(err); }
                        }
                        // benennt eine Datei synchron um (wartet auf das Ergebnis)
                        function fsRenameSync(oldPath, newPath) {
                            try {
                                var stats = fs.statSync(oldPath);
                                try { fs.renameSync(oldPath, newPath); }
                                catch(err) { if (err.code != "ENOENT") log(err); }     
                            }
                            catch(err) { if (err.code != "ENOENT") log(err); }
                        }
                        // Bild speichern und senden
                        function saveImage() {
                            // Bild imageCountMax-1 löschen
                            fsUnlinkSync( dest_path + imageNamePre + (imageCountMax-1) + ".jpg" );
                            // Bilder 0..imageCountMax-2 umbenennen
                            for (var i=imageCountMax-2; i >= 0; i-- ) { 
                                fsRenameSync(dest_path + imageNamePre + i + ".jpg", dest_path + imageNamePre + (i+1) + ".jpg"); 
                            }
                            // Bild 0 löschen
                            var fname = imageNamePre + "0.jpg";
                            fsUnlinkSync( fname );
                            // Bild holen und speichern
                            request.get({url: cam_url, encoding: 'binary'}, function (err, response, body) {
                                fs.writeFile(dest_path + fname, body, 'binary', function(err) {
                                    if (err) {
                                        log('Fehler beim Bild speichern: ' + err, 'warn');
                                    } else {
                                        // dem Filesystem 2 Sek Zeit zum Speichern lassen
                                        //setTimeout(function() { sendImage(dest_path + fname); }, 2000); 
                                    }
                                }); 
                            });
                        }
                        // sofort ein Bild senden und nach 8 Sek erneut
                        function onEvent() {
                            saveImage();
                            setTimeout(function() { saveImage(); }, 8 * 1000); 
                        }
                        // Ereignisroutine
                        on({id: oidLichtBewmelderTuer, val: true}, function (obj) {
                            onEvent( obj );
                        });
                        // manuelle Ausführung (Test)
                        onEvent();
                        
                        
                        GlasfaserG Offline
                        GlasfaserG Offline
                        Glasfaser
                        schrieb am zuletzt editiert von
                        #57

                        @Knallochse

                        Ich habe das hier so bei mir angepasst (Vorlage von Chaot) :

                        Es werde 4 Screenshot´s erstellt , per Telegramm versendet und in vis.0/klingelbild zur weiteren Verwendung hinterlegt .

                        Datenpunkt in const idklingel und die vier URL anpassen .

                        const idklingel = ["hm-rpc.2.00145709AED72D.8.PRESS_SHORT", "hm-rpc.2.00145709AED72D.8.PRESS_LONG", "ID5", "ID4"];
                        
                        var sperre = false;  //verhindert das doppeltes Drücken das Script stoppt
                        
                        var timeout1, timeout2, timeout3, timeout4, timeout5, timeout6, timeout7, timeout8, timeout9, timeout10, timeout11;
                        
                        var fs = require('fs');
                        
                        
                        
                        
                        on({id: idklingel, change: "any"}, function (obj) {
                        
                         if(!sperre) {
                        
                           sperre = true;
                        
                           
                        
                            // Speichert das erste Bild bei Klingeln
                        
                           exec('wget --output-document /tmp/haustuer1.jpg \'http://user:passwort@192.168.178.53/streaming/channels/101/picture\'');
                        
                           
                            // Nach dem ersten Bild wird nach 2000ms das nächste Bild gespeichert
                           timeout1 = setTimeout(function () {
                        
                             exec('wget --output-document /tmp/haustuer2.jpg \'http://user:passwort@192.168.178.53/streaming/channels/101/picture\''); 
                        
                           }, 2000);
                        
                           
                            // Nach dem zweiten Bild wird nach 2000ms das nächste Bild gespeichert
                           timeout2 = setTimeout(function () {
                        
                             exec('wget --output-document /tmp/haustuer3.jpg \'http://user:passwort@192.168.178.53/streaming/channels/101/picture\'');
                        
                           }, 4000);
                        
                          
                            // Nach dem dritten Bild wird nach 2000ms das nächste Bild gespeichert
                           timeout3 = setTimeout(function () {
                        
                             exec('wget --output-document /tmp/haustuer4.jpg \'http://user:passwort@192.168.178.53/streaming/channels/101/picture\'');
                        
                           }, 6000);
                        
                        
                            // Telegram versenden
                           timeout4 = setTimeout(function(){
                        
                               sendTo('telegram.0', {text: '/tmp/haustuer1.jpg', caption: 'Jemand klingelt an der Haustür !!!'});
                        
                                       //log ('__ Klingel-Bild wurde versendet __');
                        
                           }, 8000); 
                           timeout5 = setTimeout(function(){
                        
                               sendTo('telegram.0', {text: '/tmp/haustuer2.jpg', caption: 'Jemand klingelt an der Haustür !!!'});
                        
                                       //log ('__ Klingel-Bild wurde versendet __');
                        
                           }, 9000); 
                        
                        
                           }
                                  
                        
                           timeout6 = setTimeout(function() {
                        
                              sperre = false;
                        
                           }, 5000); //Zeit für Klingelsperre 1.Zeile
                        
                        
                            // Bilder werden nach vis gespeichert
                           timeout7 = setTimeout(function () {
                        
                                const bild1 = fs.readFileSync('/tmp/haustuer1.jpg');
                        
                                writeFile('vis.0','/klingelbild/haustuer1.jpg', bild1);
                        
                                const bild2 = fs.readFileSync('/tmp/haustuer2.jpg');
                        
                                writeFile('vis.0','/klingelbild/haustuer2.jpg', bild2);
                        
                                const bild3 = fs.readFileSync('/tmp/haustuer3.jpg');
                        
                                writeFile('vis.0','/klingelbild/haustuer3.jpg', bild3);
                        
                                const bild4 = fs.readFileSync('/tmp/haustuer4.jpg');
                        
                                writeFile('vis.0','/klingelbild/haustuer4.jpg', bild4);
                        
                           }, 20000); 
                        
                        });
                        
                        
                        
                        

                        Synology 918+ 16GB - ioBroker in Docker v9 , VISO auf Trekstor Primebook C13 13,3" , Hikvision Domkameras mit Surveillance Station .. CCU RaspberryMatic in Synology VM .. Zigbee CC2538+CC2592 .. Sonoff .. KNX .. Modbus ..

                        KnallochseK 1 Antwort Letzte Antwort
                        1
                        • GlasfaserG Glasfaser

                          @Knallochse

                          Ich habe das hier so bei mir angepasst (Vorlage von Chaot) :

                          Es werde 4 Screenshot´s erstellt , per Telegramm versendet und in vis.0/klingelbild zur weiteren Verwendung hinterlegt .

                          Datenpunkt in const idklingel und die vier URL anpassen .

                          const idklingel = ["hm-rpc.2.00145709AED72D.8.PRESS_SHORT", "hm-rpc.2.00145709AED72D.8.PRESS_LONG", "ID5", "ID4"];
                          
                          var sperre = false;  //verhindert das doppeltes Drücken das Script stoppt
                          
                          var timeout1, timeout2, timeout3, timeout4, timeout5, timeout6, timeout7, timeout8, timeout9, timeout10, timeout11;
                          
                          var fs = require('fs');
                          
                          
                          
                          
                          on({id: idklingel, change: "any"}, function (obj) {
                          
                           if(!sperre) {
                          
                             sperre = true;
                          
                             
                          
                              // Speichert das erste Bild bei Klingeln
                          
                             exec('wget --output-document /tmp/haustuer1.jpg \'http://user:passwort@192.168.178.53/streaming/channels/101/picture\'');
                          
                             
                              // Nach dem ersten Bild wird nach 2000ms das nächste Bild gespeichert
                             timeout1 = setTimeout(function () {
                          
                               exec('wget --output-document /tmp/haustuer2.jpg \'http://user:passwort@192.168.178.53/streaming/channels/101/picture\''); 
                          
                             }, 2000);
                          
                             
                              // Nach dem zweiten Bild wird nach 2000ms das nächste Bild gespeichert
                             timeout2 = setTimeout(function () {
                          
                               exec('wget --output-document /tmp/haustuer3.jpg \'http://user:passwort@192.168.178.53/streaming/channels/101/picture\'');
                          
                             }, 4000);
                          
                            
                              // Nach dem dritten Bild wird nach 2000ms das nächste Bild gespeichert
                             timeout3 = setTimeout(function () {
                          
                               exec('wget --output-document /tmp/haustuer4.jpg \'http://user:passwort@192.168.178.53/streaming/channels/101/picture\'');
                          
                             }, 6000);
                          
                          
                              // Telegram versenden
                             timeout4 = setTimeout(function(){
                          
                                 sendTo('telegram.0', {text: '/tmp/haustuer1.jpg', caption: 'Jemand klingelt an der Haustür !!!'});
                          
                                         //log ('__ Klingel-Bild wurde versendet __');
                          
                             }, 8000); 
                             timeout5 = setTimeout(function(){
                          
                                 sendTo('telegram.0', {text: '/tmp/haustuer2.jpg', caption: 'Jemand klingelt an der Haustür !!!'});
                          
                                         //log ('__ Klingel-Bild wurde versendet __');
                          
                             }, 9000); 
                          
                          
                             }
                                    
                          
                             timeout6 = setTimeout(function() {
                          
                                sperre = false;
                          
                             }, 5000); //Zeit für Klingelsperre 1.Zeile
                          
                          
                              // Bilder werden nach vis gespeichert
                             timeout7 = setTimeout(function () {
                          
                                  const bild1 = fs.readFileSync('/tmp/haustuer1.jpg');
                          
                                  writeFile('vis.0','/klingelbild/haustuer1.jpg', bild1);
                          
                                  const bild2 = fs.readFileSync('/tmp/haustuer2.jpg');
                          
                                  writeFile('vis.0','/klingelbild/haustuer2.jpg', bild2);
                          
                                  const bild3 = fs.readFileSync('/tmp/haustuer3.jpg');
                          
                                  writeFile('vis.0','/klingelbild/haustuer3.jpg', bild3);
                          
                                  const bild4 = fs.readFileSync('/tmp/haustuer4.jpg');
                          
                                  writeFile('vis.0','/klingelbild/haustuer4.jpg', bild4);
                          
                             }, 20000); 
                          
                          });
                          
                          
                          
                          

                          KnallochseK Offline
                          KnallochseK Offline
                          Knallochse
                          schrieb am zuletzt editiert von
                          #58

                          @Glasfaser Erstmal danke für dein Script.
                          Wenn ich dieses in Javascript importiere (ohne jegliche Änderung) wird ein Fehler bei den 4 Zeilen angezeigt

                          writeFile('vis.0','/klingelbild/haustuer1.jpg', bild1);
                          

                          Expected 4 arguments, but got 3.

                          HM&HMIP über 100 Geräte + IoBroker auf DS918+ uvm.

                          GlasfaserG 1 Antwort Letzte Antwort
                          0
                          • KnallochseK Knallochse

                            @Glasfaser Erstmal danke für dein Script.
                            Wenn ich dieses in Javascript importiere (ohne jegliche Änderung) wird ein Fehler bei den 4 Zeilen angezeigt

                            writeFile('vis.0','/klingelbild/haustuer1.jpg', bild1);
                            

                            Expected 4 arguments, but got 3.

                            GlasfaserG Offline
                            GlasfaserG Offline
                            Glasfaser
                            schrieb am zuletzt editiert von Glasfaser
                            #59

                            @Knallochse

                            Nicht beachten … das Skript funktioniert !

                            Du meinst das hier :

                            1.JPG

                            Synology 918+ 16GB - ioBroker in Docker v9 , VISO auf Trekstor Primebook C13 13,3" , Hikvision Domkameras mit Surveillance Station .. CCU RaspberryMatic in Synology VM .. Zigbee CC2538+CC2592 .. Sonoff .. KNX .. Modbus ..

                            KnallochseK 1 Antwort Letzte Antwort
                            0
                            • GlasfaserG Glasfaser

                              @Knallochse

                              Nicht beachten … das Skript funktioniert !

                              Du meinst das hier :

                              1.JPG

                              KnallochseK Offline
                              KnallochseK Offline
                              Knallochse
                              schrieb am zuletzt editiert von
                              #60

                              @Glasfaser Nochmals vielen Dank. Ich werde es nächste Woche mal probieren.
                              Den Rest des Wochenendes wurde Familienaktivitäten eingefordert 😀

                              HM&HMIP über 100 Geräte + IoBroker auf DS918+ uvm.

                              1 Antwort Letzte Antwort
                              1
                              • NegaleinN Offline
                                NegaleinN Offline
                                Negalein
                                Global Moderator
                                schrieb am zuletzt editiert von Negalein
                                #61

                                Hallo

                                Ich habe das Script hier aus dem Thread angepasst.

                                Es wird kein Bild unter dem angegebenen Pfad gespeichert.

                                Könnte bitte jemand drüberschaun?

                                // -------------------------------------------------------------------------
                                // Dieses Script überwaht den Zustand eines Bewegungsmelders und speichert bei
                                // Aktivierung ein Bild einer Überwachnungskamera in einem Vereichnis und sendet
                                // dieses via Telegram.0-Adapter. Nach 10 Sek wird ein weiteres Bild erstellt und
                                // gesendet.
                                // Die Speicherung der Bilder erfolgt als "Stack", d.h. das aktuellste Bild bekommt
                                // immer den Suffix "0" und es werden n Bilder mit den Suffixen 1..n-1 vorgehalten
                                // Uhula 2017.11
                                // -------------------------------------------------------------------------
                                // -------------------------------------------------------------------------
                                // Konfiguration
                                // -------------------------------------------------------------------------
                                   // Objekt-ID des Bewegungsmelders
                                const oidLichtBewmelderTuer = "doorbird.0.Motion.trigger";
                                   // URL zur Kamera umn ein Image (jpg) zu erhalten
                                const cam_url = "http://user:password@10.0.1.84/bha-api/image.cgi";
                                   // Pfadangabe für die Speicherung der Bilder, der Pfad muss existieren
                                const dest_path = '/opt/iobroker/iobroker-data/files/vis.0/Camsnapshot';
                                   // Anzahl der Bilder, die vorgehalten werden sollen
                                const imageCountMax = 8;                
                                   // Prefix für die Bildnamen
                                const imageNamePre = "sprechanlage_"; 
                                // -------------------------------------------------------------------------
                                // Scriptteil
                                // -------------------------------------------------------------------------
                                var request = require('request');
                                var fs      = require('fs');
                                // Bild an telegram schicken 
                                //function sendImage (path) { 
                                    //try {
                                        //var stats = fs.statSync(path);
                                        //var msg = formatDate(stats.birthtime,"DD.MM.YYYY hh:mm:ss") + " " + path.substring(path.lastIndexOf('/')+1);
                                        //sendTo('telegram.0', {
                                            //text:                   path,
                                            //caption:                msg, 
                                            //disable_notification:   true
                                        //});
                                    //}
                                    //catch(err) { if (err.code != "ENOENT") log(err); }     
                                //}
                                // löscht eine Datei synchron (wartet auf das Ergebnis)
                                function fsUnlinkSync(path) {
                                    try {
                                        var stats = fs.statSync(path);
                                        try { fs.unlinkSync(path); }
                                        catch(err) { if (err.code != "ENOENT") log(err); }     
                                    }
                                    catch(err) { if (err.code != "ENOENT") log(err); }
                                }
                                // benennt eine Datei synchron um (wartet auf das Ergebnis)
                                function fsRenameSync(oldPath, newPath) {
                                    try {
                                        var stats = fs.statSync(oldPath);
                                        try { fs.renameSync(oldPath, newPath); }
                                        catch(err) { if (err.code != "ENOENT") log(err); }     
                                    }
                                    catch(err) { if (err.code != "ENOENT") log(err); }
                                }
                                // Bild speichern und senden
                                function saveImage() {
                                    // Bild imageCountMax-1 löschen
                                    fsUnlinkSync( dest_path + imageNamePre + (imageCountMax-1) + ".jpg" );
                                    // Bilder 0..imageCountMax-2 umbenennen
                                    for (var i=imageCountMax-2; i >= 0; i-- ) { 
                                        fsRenameSync(dest_path + imageNamePre + i + ".jpg", dest_path + imageNamePre + (i+1) + ".jpg"); 
                                    }
                                    // Bild 0 löschen
                                    var fname = imageNamePre + "0.jpg";
                                    fsUnlinkSync( fname );
                                    // Bild holen und speichern
                                    request.get({url: cam_url, encoding: 'binary'}, function (err, response, body) {
                                        fs.writeFile(dest_path + fname, body, 'binary', function(err) {
                                            if (err) {
                                                log('Fehler beim Bild speichern: ' + err, 'warn');
                                            } else {
                                                // dem Filesystem 2 Sek Zeit zum Speichern lassen
                                                //setTimeout(function() { sendImage(dest_path + fname); }, 2000); 
                                            }
                                        }); 
                                    });
                                }
                                // sofort ein Bild senden und nach 8 Sek erneut
                                function onEvent() {
                                    saveImage();
                                    setTimeout(function() { saveImage(); }, 8 * 1000); 
                                }
                                // Ereignisroutine
                                on({id: oidLichtBewmelderTuer, val: true}, function (obj) {
                                    onEvent( obj );
                                });
                                // manuelle Ausführung (Test)
                                onEvent();
                                

                                ° Node.js: 20.17.0 NPM: 10.8.2
                                ° Proxmox, Ubuntu 22.04.3 LTS
                                ° Fixer ---> iob fix

                                K 1 Antwort Letzte Antwort
                                0
                                • chucky666C Offline
                                  chucky666C Offline
                                  chucky666
                                  schrieb am zuletzt editiert von chucky666
                                  #62

                                  Hallo zusammen,
                                  ich benutze dieses Script schon sehr lange , es funktioniert super.
                                  was muss ich ändern um mehr Bilder zu bekommen ? zb 3

                                  // -------------------------------------------------------------------------
                                  // Dieses Script überwaht den Zustand eines Bewegungsmelders und speichert bei
                                  // Aktivierung ein Bild einer Überwachnungskamera in einem Vereichnis und sendet
                                  // dieses via Telegram.0-Adapter. Nach 10 Sek wird ein weiteres Bild erstellt und
                                  // gesendet.
                                  // Die Speicherung der Bilder erfolgt als "Stack", d.h. das aktuellste Bild bekommt
                                  // immer den Suffix "0" und es werden n Bilder mit den Suffixen 1..n-1 vorgehalten
                                  // Uhula 2017.11
                                  // -------------------------------------------------------------------------
                                  
                                  // -------------------------------------------------------------------------
                                  // Konfiguration
                                  // -------------------------------------------------------------------------
                                        // Objekt-ID des Bewegungsmelders
                                  const oidLichtBewmelderTuer = "deconz.0.Sensors.54.open";
                                        // URL zur Kamera umn ein Image (jpg) zu erhalten
                                  const cam_url = "http://192.168.178.88/tmpfs/auto.jpg?usr=";
                                        // Pfadangabe für die Speicherung der Bilder, der Pfad muss existieren
                                  const dest_path = '/home/test/';
                                        // Anzahl der Bilder, die vorgehalten werden sollen
                                  const imageCountMax = 4;                
                                        // Prefix für die Bildnamen
                                  const imageNamePre = "test_"; 
                                  
                                  // -------------------------------------------------------------------------
                                  // Scriptteil
                                  // -------------------------------------------------------------------------
                                  var request = require('request');
                                  var fs      = require('fs');
                                  
                                  // Bild an telegram schicken 
                                  function sendImage (path) { 
                                      try {
                                          var stats = fs.statSync(path);
                                          var msg = formatDate(stats.birthtime,"DD.MM.YYYY hh:mm:ss") + " " + path.substring(path.lastIndexOf('/')+1);
                                          sendTo('telegram.0', {
                                              text:                   path,
                                              caption:                msg, 
                                              disable_notification:   true
                                          });
                                      }
                                      catch(err) { if (err.code != "ENOENT") log(err); }     
                                  }
                                  
                                  // löscht eine Datei synchron (wartet auf das Ergebnis)
                                  function fsUnlinkSync(path) {
                                      try {
                                          var stats = fs.statSync(path);
                                          try { fs.unlinkSync(path); }
                                          catch(err) { if (err.code != "ENOENT") log(err); }     
                                      }
                                      catch(err) { if (err.code != "ENOENT") log(err); }
                                  }
                                  
                                  // benennt eine Datei synchron um (wartet auf das Ergebnis)
                                  function fsRenameSync(oldPath, newPath) {
                                      try {
                                          var stats = fs.statSync(oldPath);
                                          try { fs.renameSync(oldPath, newPath); }
                                          catch(err) { if (err.code != "ENOENT") log(err); }     
                                      }
                                      catch(err) { if (err.code != "ENOENT") log(err); }
                                  }
                                  
                                  // Bild speichern und senden
                                  function saveImage() {
                                      // Bild imageCountMax-1 löschen
                                      fsUnlinkSync( dest_path + imageNamePre + (imageCountMax-1) + ".jpg" );
                                      // Bilder 0..imageCountMax-2 umbenennen
                                      for (var i=imageCountMax-2; i >= 0; i-- ) { 
                                          fsRenameSync(dest_path + imageNamePre + i + ".jpg", dest_path + imageNamePre + (i+1) + ".jpg"); 
                                      }
                                      // Bild 0 löschen
                                      var fname = imageNamePre + "0.jpg";
                                      fsUnlinkSync( fname );
                                      // Bild holen und speichern
                                      request.get({url: cam_url, encoding: 'binary'}, function (err, response, body) {
                                          fs.writeFile(dest_path + fname, body, 'binary', function(err) {
                                              if (err) {
                                                  log('Fehler beim Bild speichern: ' + err, 'warn');
                                              } else {
                                                  // dem Filesystem 2 Sek Zeit zum Speichern lassen
                                                  setTimeout(function() { sendImage(dest_path + fname); }, 1000); 
                                              }
                                          }); 
                                      });
                                  }
                                  
                                  // sofort ein Bild senden und nach 10 Sek erneut
                                  function onEvent() {
                                      saveImage();
                                      setTimeout(function() { saveImage(); }, 2 * 1000); 
                                  }
                                  
                                  // Ereignisroutine
                                  on({id: oidLichtBewmelderTuer, val: true}, function (obj) {
                                      onEvent( obj );
                                  });
                                  
                                  // manuelle Ausführung (Test)
                                  onEvent();
                                  
                                  S K 2 Antworten Letzte Antwort
                                  0
                                  • chucky666C chucky666

                                    Hallo zusammen,
                                    ich benutze dieses Script schon sehr lange , es funktioniert super.
                                    was muss ich ändern um mehr Bilder zu bekommen ? zb 3

                                    // -------------------------------------------------------------------------
                                    // Dieses Script überwaht den Zustand eines Bewegungsmelders und speichert bei
                                    // Aktivierung ein Bild einer Überwachnungskamera in einem Vereichnis und sendet
                                    // dieses via Telegram.0-Adapter. Nach 10 Sek wird ein weiteres Bild erstellt und
                                    // gesendet.
                                    // Die Speicherung der Bilder erfolgt als "Stack", d.h. das aktuellste Bild bekommt
                                    // immer den Suffix "0" und es werden n Bilder mit den Suffixen 1..n-1 vorgehalten
                                    // Uhula 2017.11
                                    // -------------------------------------------------------------------------
                                    
                                    // -------------------------------------------------------------------------
                                    // Konfiguration
                                    // -------------------------------------------------------------------------
                                          // Objekt-ID des Bewegungsmelders
                                    const oidLichtBewmelderTuer = "deconz.0.Sensors.54.open";
                                          // URL zur Kamera umn ein Image (jpg) zu erhalten
                                    const cam_url = "http://192.168.178.88/tmpfs/auto.jpg?usr=";
                                          // Pfadangabe für die Speicherung der Bilder, der Pfad muss existieren
                                    const dest_path = '/home/test/';
                                          // Anzahl der Bilder, die vorgehalten werden sollen
                                    const imageCountMax = 4;                
                                          // Prefix für die Bildnamen
                                    const imageNamePre = "test_"; 
                                    
                                    // -------------------------------------------------------------------------
                                    // Scriptteil
                                    // -------------------------------------------------------------------------
                                    var request = require('request');
                                    var fs      = require('fs');
                                    
                                    // Bild an telegram schicken 
                                    function sendImage (path) { 
                                        try {
                                            var stats = fs.statSync(path);
                                            var msg = formatDate(stats.birthtime,"DD.MM.YYYY hh:mm:ss") + " " + path.substring(path.lastIndexOf('/')+1);
                                            sendTo('telegram.0', {
                                                text:                   path,
                                                caption:                msg, 
                                                disable_notification:   true
                                            });
                                        }
                                        catch(err) { if (err.code != "ENOENT") log(err); }     
                                    }
                                    
                                    // löscht eine Datei synchron (wartet auf das Ergebnis)
                                    function fsUnlinkSync(path) {
                                        try {
                                            var stats = fs.statSync(path);
                                            try { fs.unlinkSync(path); }
                                            catch(err) { if (err.code != "ENOENT") log(err); }     
                                        }
                                        catch(err) { if (err.code != "ENOENT") log(err); }
                                    }
                                    
                                    // benennt eine Datei synchron um (wartet auf das Ergebnis)
                                    function fsRenameSync(oldPath, newPath) {
                                        try {
                                            var stats = fs.statSync(oldPath);
                                            try { fs.renameSync(oldPath, newPath); }
                                            catch(err) { if (err.code != "ENOENT") log(err); }     
                                        }
                                        catch(err) { if (err.code != "ENOENT") log(err); }
                                    }
                                    
                                    // Bild speichern und senden
                                    function saveImage() {
                                        // Bild imageCountMax-1 löschen
                                        fsUnlinkSync( dest_path + imageNamePre + (imageCountMax-1) + ".jpg" );
                                        // Bilder 0..imageCountMax-2 umbenennen
                                        for (var i=imageCountMax-2; i >= 0; i-- ) { 
                                            fsRenameSync(dest_path + imageNamePre + i + ".jpg", dest_path + imageNamePre + (i+1) + ".jpg"); 
                                        }
                                        // Bild 0 löschen
                                        var fname = imageNamePre + "0.jpg";
                                        fsUnlinkSync( fname );
                                        // Bild holen und speichern
                                        request.get({url: cam_url, encoding: 'binary'}, function (err, response, body) {
                                            fs.writeFile(dest_path + fname, body, 'binary', function(err) {
                                                if (err) {
                                                    log('Fehler beim Bild speichern: ' + err, 'warn');
                                                } else {
                                                    // dem Filesystem 2 Sek Zeit zum Speichern lassen
                                                    setTimeout(function() { sendImage(dest_path + fname); }, 1000); 
                                                }
                                            }); 
                                        });
                                    }
                                    
                                    // sofort ein Bild senden und nach 10 Sek erneut
                                    function onEvent() {
                                        saveImage();
                                        setTimeout(function() { saveImage(); }, 2 * 1000); 
                                    }
                                    
                                    // Ereignisroutine
                                    on({id: oidLichtBewmelderTuer, val: true}, function (obj) {
                                        onEvent( obj );
                                    });
                                    
                                    // manuelle Ausführung (Test)
                                    onEvent();
                                    
                                    S Offline
                                    S Offline
                                    Stoni
                                    schrieb am zuletzt editiert von
                                    #63

                                    @chucky666 Kann Dir leider keine Antwort auf Deine Frage geben, aber vielleicht kannst Du mir helfen. Wollte Dein Script auch mal testen, aber ich glaube, es fehlt mir an Berechtigungen.

                                    Folgende Fehlermeldung kommt:

                                    javascript.0
                                    2020-02-01 15:54:22.135
                                    warn
                                    (793) script.js.common.Telegram_Bilder: Fehler beim Bild speichern: Error: EACCES: permission denied, open '/home/test_0.jpg
                                    

                                    Ich konnte unter /Home/ auch keinen neuen Ordner erstellen, wo die Bilder temporär gespeichert werden sollen. Irgendwie muss ich die Berechtigung erlangen über root oder ähnliches. Wie geht das?

                                    Viele Grüße

                                    1 Antwort Letzte Antwort
                                    0
                                    • chucky666C Offline
                                      chucky666C Offline
                                      chucky666
                                      schrieb am zuletzt editiert von
                                      #64

                                      Den Ordner habe ich mit Root erstellt und eine 775 Berechtigung .

                                      S 1 Antwort Letzte Antwort
                                      0
                                      • chucky666C chucky666

                                        Den Ordner habe ich mit Root erstellt und eine 775 Berechtigung .

                                        S Offline
                                        S Offline
                                        Stoni
                                        schrieb am zuletzt editiert von
                                        #65

                                        @chucky666 sagte in [Frage BLOCKLY ] Klingel Bild per Telegram versenden / Snapshot von Cam per Telegram versenden:

                                        Den Ordner habe ich mit Root erstellt und eine 775 Berechtigung .

                                        Wie hast du das gemacht?

                                        1 Antwort Letzte Antwort
                                        0
                                        • chucky666C chucky666

                                          Hallo zusammen,
                                          ich benutze dieses Script schon sehr lange , es funktioniert super.
                                          was muss ich ändern um mehr Bilder zu bekommen ? zb 3

                                          // -------------------------------------------------------------------------
                                          // Dieses Script überwaht den Zustand eines Bewegungsmelders und speichert bei
                                          // Aktivierung ein Bild einer Überwachnungskamera in einem Vereichnis und sendet
                                          // dieses via Telegram.0-Adapter. Nach 10 Sek wird ein weiteres Bild erstellt und
                                          // gesendet.
                                          // Die Speicherung der Bilder erfolgt als "Stack", d.h. das aktuellste Bild bekommt
                                          // immer den Suffix "0" und es werden n Bilder mit den Suffixen 1..n-1 vorgehalten
                                          // Uhula 2017.11
                                          // -------------------------------------------------------------------------
                                          
                                          // -------------------------------------------------------------------------
                                          // Konfiguration
                                          // -------------------------------------------------------------------------
                                                // Objekt-ID des Bewegungsmelders
                                          const oidLichtBewmelderTuer = "deconz.0.Sensors.54.open";
                                                // URL zur Kamera umn ein Image (jpg) zu erhalten
                                          const cam_url = "http://192.168.178.88/tmpfs/auto.jpg?usr=";
                                                // Pfadangabe für die Speicherung der Bilder, der Pfad muss existieren
                                          const dest_path = '/home/test/';
                                                // Anzahl der Bilder, die vorgehalten werden sollen
                                          const imageCountMax = 4;                
                                                // Prefix für die Bildnamen
                                          const imageNamePre = "test_"; 
                                          
                                          // -------------------------------------------------------------------------
                                          // Scriptteil
                                          // -------------------------------------------------------------------------
                                          var request = require('request');
                                          var fs      = require('fs');
                                          
                                          // Bild an telegram schicken 
                                          function sendImage (path) { 
                                              try {
                                                  var stats = fs.statSync(path);
                                                  var msg = formatDate(stats.birthtime,"DD.MM.YYYY hh:mm:ss") + " " + path.substring(path.lastIndexOf('/')+1);
                                                  sendTo('telegram.0', {
                                                      text:                   path,
                                                      caption:                msg, 
                                                      disable_notification:   true
                                                  });
                                              }
                                              catch(err) { if (err.code != "ENOENT") log(err); }     
                                          }
                                          
                                          // löscht eine Datei synchron (wartet auf das Ergebnis)
                                          function fsUnlinkSync(path) {
                                              try {
                                                  var stats = fs.statSync(path);
                                                  try { fs.unlinkSync(path); }
                                                  catch(err) { if (err.code != "ENOENT") log(err); }     
                                              }
                                              catch(err) { if (err.code != "ENOENT") log(err); }
                                          }
                                          
                                          // benennt eine Datei synchron um (wartet auf das Ergebnis)
                                          function fsRenameSync(oldPath, newPath) {
                                              try {
                                                  var stats = fs.statSync(oldPath);
                                                  try { fs.renameSync(oldPath, newPath); }
                                                  catch(err) { if (err.code != "ENOENT") log(err); }     
                                              }
                                              catch(err) { if (err.code != "ENOENT") log(err); }
                                          }
                                          
                                          // Bild speichern und senden
                                          function saveImage() {
                                              // Bild imageCountMax-1 löschen
                                              fsUnlinkSync( dest_path + imageNamePre + (imageCountMax-1) + ".jpg" );
                                              // Bilder 0..imageCountMax-2 umbenennen
                                              for (var i=imageCountMax-2; i >= 0; i-- ) { 
                                                  fsRenameSync(dest_path + imageNamePre + i + ".jpg", dest_path + imageNamePre + (i+1) + ".jpg"); 
                                              }
                                              // Bild 0 löschen
                                              var fname = imageNamePre + "0.jpg";
                                              fsUnlinkSync( fname );
                                              // Bild holen und speichern
                                              request.get({url: cam_url, encoding: 'binary'}, function (err, response, body) {
                                                  fs.writeFile(dest_path + fname, body, 'binary', function(err) {
                                                      if (err) {
                                                          log('Fehler beim Bild speichern: ' + err, 'warn');
                                                      } else {
                                                          // dem Filesystem 2 Sek Zeit zum Speichern lassen
                                                          setTimeout(function() { sendImage(dest_path + fname); }, 1000); 
                                                      }
                                                  }); 
                                              });
                                          }
                                          
                                          // sofort ein Bild senden und nach 10 Sek erneut
                                          function onEvent() {
                                              saveImage();
                                              setTimeout(function() { saveImage(); }, 2 * 1000); 
                                          }
                                          
                                          // Ereignisroutine
                                          on({id: oidLichtBewmelderTuer, val: true}, function (obj) {
                                              onEvent( obj );
                                          });
                                          
                                          // manuelle Ausführung (Test)
                                          onEvent();
                                          
                                          K Offline
                                          K Offline
                                          klaus88
                                          schrieb am zuletzt editiert von klaus88
                                          #66

                                          @chucky666 : Du musst im Abschnitt:

                                          // sofort ein Bild senden und nach 10 Sek erneut
                                          function onEvent() {
                                              saveImage();
                                              setTimeout(function() { saveImage(); }, 2 * 1000); 
                                          }
                                          

                                          neue Zeiten eintragen !
                                          ich habe z.B. folgendes eingetragen:

                                          function onEvent() {
                                              saveImage();
                                              setTimeout(function() { saveImage(); }, 10 * 1000);
                                          	setTimeout(function() { saveImage(); }, 15 * 1000);
                                          	setTimeout(function() { saveImage(); }, 20 * 1000);
                                          	setTimeout(function() { saveImage(); }, 40 * 1000); 	
                                          }
                                          

                                          damit bekomme ich sofort und in 10, 15, 20 und 40 sek ein Bild.
                                          Hoffentlich gelingt es
                                          lg
                                          Klaus

                                          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

                                          384

                                          Online

                                          32.5k

                                          Benutzer

                                          81.6k

                                          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