Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • 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

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. JavaScript
  5. JS-MQTT DP eines Bildes (JFIF) in Datei schreiben (jpg)

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    17
    1
    2.9k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.1k

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.4k

JS-MQTT DP eines Bildes (JFIF) in Datei schreiben (jpg)

Scheduled Pinned Locked Moved JavaScript
javascript
41 Posts 7 Posters 6.0k Views 8 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • coyoteC coyote

    @kuumaur @SidM
    Nee bin da nicht weiter. Ich schicke mir jetzt per Telegram einen Snapshot der Kamera, sobald eine Person erkannt wird

    S Offline
    S Offline
    SidM
    wrote on last edited by
    #30

    @coyote Ok danke für deine Nachricht!

    Mache es momentan auch nicht anders und schicke mir ebenfalls den Snapshot der Kamera. ich bleibe aber bei den Thema dran!

    K 1 Reply Last reply
    0
    • S SidM

      @coyote Ok danke für deine Nachricht!

      Mache es momentan auch nicht anders und schicke mir ebenfalls den Snapshot der Kamera. ich bleibe aber bei den Thema dran!

      K Offline
      K Offline
      kuumaur
      wrote on last edited by
      #31

      @sidm @coyote
      Wie kommt Ihr an den Snapshot ran?

      Proxmox | IoBroker LXC Container | Zigbee | Rhasspy Voice | SqueezeBox | Frigate CCTV | Jarvis Vis |

      coyoteC 1 Reply Last reply
      0
      • K kuumaur

        @sidm @coyote
        Wie kommt Ihr an den Snapshot ran?

        coyoteC Offline
        coyoteC Offline
        coyote
        Most Active
        wrote on last edited by
        #32

        @kuumaur

        direkt über den Reolink Kamera Befehl:

        http://IP:Port/cgi-bin/api.cgi?cmd=Snap&channel=0&user=XXXX&password=XXXX
        
        K 1 Reply Last reply
        0
        • coyoteC coyote

          @kuumaur

          direkt über den Reolink Kamera Befehl:

          http://IP:Port/cgi-bin/api.cgi?cmd=Snap&channel=0&user=XXXX&password=XXXX
          
          K Offline
          K Offline
          kuumaur
          wrote on last edited by
          #33

          Basierend auf der Idee, die Snapshots von der Kamera zu holen, habe ich mir gedacht, dass das auch mit Frigate gehen könnte.

          request('http://cctv-prod.fritz.box:5000/clips/carport-1662213375.272777-0mdq87.jpg', async function (error, response, result) {
          }
          

          Ich habe nur leider keinen Schimmer, wie ich die Datei via E-Mail versende.
          An die Clip ID komme ich via MQTT ran.

          PS: Wen müsste man ansprechen, damit das Auslesen des Bildes via MQTT klappt?

          Proxmox | IoBroker LXC Container | Zigbee | Rhasspy Voice | SqueezeBox | Frigate CCTV | Jarvis Vis |

          K 1 Reply Last reply
          0
          • K kuumaur

            Basierend auf der Idee, die Snapshots von der Kamera zu holen, habe ich mir gedacht, dass das auch mit Frigate gehen könnte.

            request('http://cctv-prod.fritz.box:5000/clips/carport-1662213375.272777-0mdq87.jpg', async function (error, response, result) {
            }
            

            Ich habe nur leider keinen Schimmer, wie ich die Datei via E-Mail versende.
            An die Clip ID komme ich via MQTT ran.

            PS: Wen müsste man ansprechen, damit das Auslesen des Bildes via MQTT klappt?

            K Offline
            K Offline
            kuumaur
            wrote on last edited by
            #34

            @coyote @SidM
            Moin,
            ich habe mich weiter an den Bildern versucht.
            Bin mit meinem Ergebnis als ersten Schuss zufrieden.
            (Eigentlich aber nicht wirklich, ich hätte gerne die Clips inkludiert.)

            Hier mein Code:

            var fs = require('fs');
            var dest_path = '/var/lib/iobroker_files/';
            var whole_path = '';
            
            function extractEventData(message) {
                const parsedMessage = JSON.parse(message);
                let extractedJSON = {};
                extractedJSON.eventtype = parsedMessage.type;
                extractedJSON.beforecamera = parsedMessage.before.camera;
                extractedJSON.beforelabel = parsedMessage.before.label;
                extractedJSON.beforesnapshot_time = parsedMessage.before.snapshot_time;
            	extractedJSON.beforeid = parsedMessage.before.id;
                extractedJSON.beforecurrentzones = parsedMessage.before.current_zones;
                extractedJSON.beforeenteredzones = parsedMessage.before.entered_zones;
            
                extractedJSON.aftercamera = parsedMessage.after.camera;
                extractedJSON.afterlabel = parsedMessage.after.label;
                extractedJSON.aftersnapshot_time = parsedMessage.after.snapshot_time;
            	extractedJSON.afterid = parsedMessage.after.id;
                
                //extractedJSON.before.entered_zones {};
                //parsedMessage.before.entered_zones.forEach(zone => {
                //    extractedJSON.before.entered_zones[zone.ZoneName] = zone.value.value;
                //});
                return extractedJSON;
            }
            
            on({id: [].concat(['mqtt.0.frigate.events']), change: "ne" }, function (obj) {
                var value = obj.state.val;
                var oldValue = obj.oldState.val;
                const extractedJSON = extractEventData(obj.state.val);
                const beforecamera = extractedJSON.beforecamera;
                const beforelabel = extractedJSON.beforelabel;
                const beforesnapshot_time = extractedJSON.beforesnapshot_time;
                const beforeid = extractedJSON.beforeid;
                const aftercamera = extractedJSON.aftercamera;
                const afterlabel = extractedJSON.afterlabel;
                const aftersnapshot_time = extractedJSON.aftersnapshot_time;
                const afterid = extractedJSON.afterid;
                const eventtype = extractedJSON.eventtype;
                //var data = getState('mqtt.0.frigate.carport.person.snapshot').val;
                if (eventtype == 'update') {console.log('Script: Status_cctv Event: | '+eventtype+' | '+beforecamera+' | '+beforeid+' | '+beforelabel);}
                if (eventtype == 'end') {console.log('Script: Status_cctv Event: | '+eventtype+' | '+beforecamera+' | '+beforeid+' | '+beforelabel);}
                if (eventtype == 'new') {
                exec('wget -O /var/lib/iobroker_files/'+beforeid+'.jpg http://cctv-prod.fritz.box:5000/api/events/'+beforeid+'/snapshot.jpg');
                exec('wget -O /var/lib/iobroker_files/'+beforecamera+'-'+beforeid+'.jpg http://cctv-prod.fritz.box:5000/clips/'+beforecamera+'-'+beforeid+'.jpg');
                whole_path = dest_path;
                whole_path += beforecamera;
                whole_path += '-';
                whole_path += beforeid;
                whole_path += '.jpg';
                sendTo("email", "send", {
                    text: (['Script: Status_cctv Event: '+eventtype,'\n','Label:'+beforelabel,'\n','Camera:'+beforecamera,'\n','Eventtype:'+eventtype].join('')),
                    to: 'john@doe.cc',
                    subject: 'Script: Status_cctv Event: '+eventtype+' Camera:'+beforecamera+' Label:'+beforelabel+' v6',
                    attachments:[
                        {path: '/var/lib/iobroker_files/'+beforecamera+'-'+beforeid+'.jpg', cid: "file1"},
                        {path: '/var/lib/iobroker_files/'+beforeid+'.jpg', cid: "file2"},
                        ]
                });
                console.log('Script: Status_cctv Event: | '+eventtype+' | '+beforecamera+' | '+beforeid+' | '+beforelabel);
                }
            });
            //************************ Events ************************
            

            Proxmox | IoBroker LXC Container | Zigbee | Rhasspy Voice | SqueezeBox | Frigate CCTV | Jarvis Vis |

            coyoteC 1 Reply Last reply
            0
            • K kuumaur

              @coyote @SidM
              Moin,
              ich habe mich weiter an den Bildern versucht.
              Bin mit meinem Ergebnis als ersten Schuss zufrieden.
              (Eigentlich aber nicht wirklich, ich hätte gerne die Clips inkludiert.)

              Hier mein Code:

              var fs = require('fs');
              var dest_path = '/var/lib/iobroker_files/';
              var whole_path = '';
              
              function extractEventData(message) {
                  const parsedMessage = JSON.parse(message);
                  let extractedJSON = {};
                  extractedJSON.eventtype = parsedMessage.type;
                  extractedJSON.beforecamera = parsedMessage.before.camera;
                  extractedJSON.beforelabel = parsedMessage.before.label;
                  extractedJSON.beforesnapshot_time = parsedMessage.before.snapshot_time;
              	extractedJSON.beforeid = parsedMessage.before.id;
                  extractedJSON.beforecurrentzones = parsedMessage.before.current_zones;
                  extractedJSON.beforeenteredzones = parsedMessage.before.entered_zones;
              
                  extractedJSON.aftercamera = parsedMessage.after.camera;
                  extractedJSON.afterlabel = parsedMessage.after.label;
                  extractedJSON.aftersnapshot_time = parsedMessage.after.snapshot_time;
              	extractedJSON.afterid = parsedMessage.after.id;
                  
                  //extractedJSON.before.entered_zones {};
                  //parsedMessage.before.entered_zones.forEach(zone => {
                  //    extractedJSON.before.entered_zones[zone.ZoneName] = zone.value.value;
                  //});
                  return extractedJSON;
              }
              
              on({id: [].concat(['mqtt.0.frigate.events']), change: "ne" }, function (obj) {
                  var value = obj.state.val;
                  var oldValue = obj.oldState.val;
                  const extractedJSON = extractEventData(obj.state.val);
                  const beforecamera = extractedJSON.beforecamera;
                  const beforelabel = extractedJSON.beforelabel;
                  const beforesnapshot_time = extractedJSON.beforesnapshot_time;
                  const beforeid = extractedJSON.beforeid;
                  const aftercamera = extractedJSON.aftercamera;
                  const afterlabel = extractedJSON.afterlabel;
                  const aftersnapshot_time = extractedJSON.aftersnapshot_time;
                  const afterid = extractedJSON.afterid;
                  const eventtype = extractedJSON.eventtype;
                  //var data = getState('mqtt.0.frigate.carport.person.snapshot').val;
                  if (eventtype == 'update') {console.log('Script: Status_cctv Event: | '+eventtype+' | '+beforecamera+' | '+beforeid+' | '+beforelabel);}
                  if (eventtype == 'end') {console.log('Script: Status_cctv Event: | '+eventtype+' | '+beforecamera+' | '+beforeid+' | '+beforelabel);}
                  if (eventtype == 'new') {
                  exec('wget -O /var/lib/iobroker_files/'+beforeid+'.jpg http://cctv-prod.fritz.box:5000/api/events/'+beforeid+'/snapshot.jpg');
                  exec('wget -O /var/lib/iobroker_files/'+beforecamera+'-'+beforeid+'.jpg http://cctv-prod.fritz.box:5000/clips/'+beforecamera+'-'+beforeid+'.jpg');
                  whole_path = dest_path;
                  whole_path += beforecamera;
                  whole_path += '-';
                  whole_path += beforeid;
                  whole_path += '.jpg';
                  sendTo("email", "send", {
                      text: (['Script: Status_cctv Event: '+eventtype,'\n','Label:'+beforelabel,'\n','Camera:'+beforecamera,'\n','Eventtype:'+eventtype].join('')),
                      to: 'john@doe.cc',
                      subject: 'Script: Status_cctv Event: '+eventtype+' Camera:'+beforecamera+' Label:'+beforelabel+' v6',
                      attachments:[
                          {path: '/var/lib/iobroker_files/'+beforecamera+'-'+beforeid+'.jpg', cid: "file1"},
                          {path: '/var/lib/iobroker_files/'+beforeid+'.jpg', cid: "file2"},
                          ]
                  });
                  console.log('Script: Status_cctv Event: | '+eventtype+' | '+beforecamera+' | '+beforeid+' | '+beforelabel);
                  }
              });
              //************************ Events ************************
              
              coyoteC Offline
              coyoteC Offline
              coyote
              Most Active
              wrote on last edited by
              #35

              @kuumaur hm, heißt du schnappst dir den Snapshot direkt von frigate und schickst ihn dir per Mail, richtig?
              Das muss ich mal testen, anstatt per Mail schicke ich ihn dann per Telegram.
              Clips wäre natürlich richtig cool

              K 1 Reply Last reply
              0
              • coyoteC coyote

                @kuumaur hm, heißt du schnappst dir den Snapshot direkt von frigate und schickst ihn dir per Mail, richtig?
                Das muss ich mal testen, anstatt per Mail schicke ich ihn dann per Telegram.
                Clips wäre natürlich richtig cool

                K Offline
                K Offline
                kuumaur
                wrote on last edited by
                #36

                @coyote @SidM
                Ja genau, inspiriert durch den Aufruf bei den Reolink-Kameras. Die Http-Api von Frigate ist ja recht umfangreich.

                Bei den Clips bin ich mir nicht sicher, warum ich die nicht bekomme. Entweder habe ich einen Tippfehler, den ich nicht sehe oder die Clip Dateien werden erst etwas später geschrieben und liegen noch nicht vor.

                Proxmox | IoBroker LXC Container | Zigbee | Rhasspy Voice | SqueezeBox | Frigate CCTV | Jarvis Vis |

                coyoteC 1 Reply Last reply
                0
                • K kuumaur

                  @coyote @SidM
                  Ja genau, inspiriert durch den Aufruf bei den Reolink-Kameras. Die Http-Api von Frigate ist ja recht umfangreich.

                  Bei den Clips bin ich mir nicht sicher, warum ich die nicht bekomme. Entweder habe ich einen Tippfehler, den ich nicht sehe oder die Clip Dateien werden erst etwas später geschrieben und liegen noch nicht vor.

                  coyoteC Offline
                  coyoteC Offline
                  coyote
                  Most Active
                  wrote on last edited by
                  #37

                  @kuumaur
                  Oh, ich merke gerade, dass ich schon lange nicht mehr in die frigate Docu geschaut habe. Wusste gar nicht, dass ich mittlerweile den Snap über http anfragen kann 😁
                  Ja das kann sein, dass es etwas dauert bis die clips zu Verfügung stehen

                  K 1 Reply Last reply
                  0
                  • coyoteC coyote

                    @kuumaur
                    Oh, ich merke gerade, dass ich schon lange nicht mehr in die frigate Docu geschaut habe. Wusste gar nicht, dass ich mittlerweile den Snap über http anfragen kann 😁
                    Ja das kann sein, dass es etwas dauert bis die clips zu Verfügung stehen

                    K Offline
                    K Offline
                    kuumaur
                    wrote on last edited by kuumaur
                    #38

                    @coyote @SidM
                    Mit dieser Version bin ich fast zufrieden. Die E-Mails kommen noch doppelt an, ohne dass ich den Grund erkenne.

                    var fs = require('fs');
                    var dest_path = '/var/lib/iobroker_files/';
                    var whole_path = '';
                    
                    function extractEventData(message) {
                        const parsedMessage = JSON.parse(message);
                        let extractedJSON = {};
                        extractedJSON.eventtype = parsedMessage.type;
                        extractedJSON.beforecamera = parsedMessage.before.camera;
                        extractedJSON.beforelabel = parsedMessage.before.label;
                    	extractedJSON.beforeid = parsedMessage.before.id;
                        extractedJSON.beforecurrentzones = parsedMessage.before.current_zones;
                        extractedJSON.beforeenteredzones = parsedMessage.before.entered_zones;
                        extractedJSON.beforeframetime = parsedMessage.before.frame_time;
                        extractedJSON.beforesnapshottime = parsedMessage.before.snapshot_time;
                    
                        extractedJSON.aftercamera = parsedMessage.after.camera;
                        extractedJSON.afterlabel = parsedMessage.after.label;
                        extractedJSON.aftersnapshot_time = parsedMessage.after.snapshot_time;
                    	extractedJSON.afterid = parsedMessage.after.id;
                        
                        //extractedJSON.before.entered_zones {};
                        //parsedMessage.before.entered_zones.forEach(zone => {
                        //    extractedJSON.before.entered_zones[zone.ZoneName] = zone.value.value;
                        //});
                        return extractedJSON;
                    }
                    
                    on({id: [].concat(['mqtt.0.frigate.events']), change: "ne" }, function (obj) {
                        var value = obj.state.val;
                        var oldValue = obj.oldState.val;
                        const extractedJSON = extractEventData(obj.state.val);
                        const beforecamera = extractedJSON.beforecamera;
                        const beforelabel = extractedJSON.beforelabel;
                        const beforeid = extractedJSON.beforeid;
                        const beforeframetime = extractedJSON.beforeframetime;
                        const beforesnapshottime = extractedJSON.beforesnapshottime;
                    
                        const aftercamera = extractedJSON.aftercamera;
                        const afterlabel = extractedJSON.afterlabel;
                        const aftersnapshot_time = extractedJSON.aftersnapshot_time;
                        const afterid = extractedJSON.afterid;
                        const eventtype = extractedJSON.eventtype;
                        //var data = getState('mqtt.0.frigate.carport.person.snapshot').val;
                        if (eventtype == 'update') {console.log('Script: Status_cctv Event: | '+eventtype+' | '+beforecamera+' | '+beforeid+' | '+beforelabel+' | '+beforeframetime+' | '+beforesnapshottime);}
                        if (eventtype == 'new') {console.log('Script: Status_cctv Event: | '+eventtype+' | '+beforecamera+' | '+beforeid+' | '+beforelabel+' | '+beforeframetime+' | '+beforesnapshottime);}
                        if (eventtype == 'end') {
                        exec('wget -O '+dest_path+beforeid+'.jpg http://cctv-prod.fritz.box:5000/api/events/'+beforeid+'/snapshot.jpg');
                        exec('wget -O '+dest_path+beforecamera+'-'+beforeid+'.jpg http://cctv-prod.fritz.box:5000/clips/'+beforecamera+'-'+beforeid+'.jpg');
                    
                        //getBinaryState(idPic, async function (err, data){
                        //    fs.writeFile('test.jpg', data, function (err) {
                        //        if(err) log('Fehler!');
                        //    });                
                        //});
                        
                        whole_path = dest_path;
                        whole_path += beforecamera;
                        whole_path += '-';
                        whole_path += beforeid;
                        whole_path += '.jpg';
                        
                        //fs.writeFile(whole_path, data, (err) => {if (err) throw err;console.log('File written ' + whole_path);});
                        
                        sendTo("email", "send", {
                            text: (['Script: Status_cctv Event: '+eventtype,'\n','Label:'+beforelabel,'\n','Camera:'+beforecamera,'\n','Eventtype:'+eventtype,'\n','Frame Time:'+beforeframetime,'\n','Snapshot Time:'+beforesnapshottime].join('')),
                            to: 'john@doe.cc',
                            subject: 'Script: Status_cctv Event: '+eventtype+' Camera:'+beforecamera+' Label:'+beforelabel+' v9',
                            attachments:[
                                {path: dest_path+beforecamera+'-'+beforeid+'.jpg', cid: "file1"}
                                //{path: dest_path+beforeid+'.jpg', cid: "file2"},
                                ]
                        });
                        console.log('Script: Status_cctv Event: | '+eventtype+' | '+beforecamera+' | '+beforeid+' | '+beforelabel+' | '+beforeframetime+' | '+beforesnapshottime);
                        exec('/usr/bin/rm -f '+dest_path+beforecamera+'-'+beforeid+'.jpg');
                        exec('/usr/bin/rm -f '+dest_path+beforeid+'.jpg');
                        
                        //sendTo("pushover.0", "send", {
                        //    message: 'Script: Status_cctv Event: changed',
                        //    sound: ""
                        //});
                    
                        }
                    });
                    

                    Proxmox | IoBroker LXC Container | Zigbee | Rhasspy Voice | SqueezeBox | Frigate CCTV | Jarvis Vis |

                    Rob_inR 1 Reply Last reply
                    0
                    • K kuumaur

                      @coyote @SidM
                      Mit dieser Version bin ich fast zufrieden. Die E-Mails kommen noch doppelt an, ohne dass ich den Grund erkenne.

                      var fs = require('fs');
                      var dest_path = '/var/lib/iobroker_files/';
                      var whole_path = '';
                      
                      function extractEventData(message) {
                          const parsedMessage = JSON.parse(message);
                          let extractedJSON = {};
                          extractedJSON.eventtype = parsedMessage.type;
                          extractedJSON.beforecamera = parsedMessage.before.camera;
                          extractedJSON.beforelabel = parsedMessage.before.label;
                      	extractedJSON.beforeid = parsedMessage.before.id;
                          extractedJSON.beforecurrentzones = parsedMessage.before.current_zones;
                          extractedJSON.beforeenteredzones = parsedMessage.before.entered_zones;
                          extractedJSON.beforeframetime = parsedMessage.before.frame_time;
                          extractedJSON.beforesnapshottime = parsedMessage.before.snapshot_time;
                      
                          extractedJSON.aftercamera = parsedMessage.after.camera;
                          extractedJSON.afterlabel = parsedMessage.after.label;
                          extractedJSON.aftersnapshot_time = parsedMessage.after.snapshot_time;
                      	extractedJSON.afterid = parsedMessage.after.id;
                          
                          //extractedJSON.before.entered_zones {};
                          //parsedMessage.before.entered_zones.forEach(zone => {
                          //    extractedJSON.before.entered_zones[zone.ZoneName] = zone.value.value;
                          //});
                          return extractedJSON;
                      }
                      
                      on({id: [].concat(['mqtt.0.frigate.events']), change: "ne" }, function (obj) {
                          var value = obj.state.val;
                          var oldValue = obj.oldState.val;
                          const extractedJSON = extractEventData(obj.state.val);
                          const beforecamera = extractedJSON.beforecamera;
                          const beforelabel = extractedJSON.beforelabel;
                          const beforeid = extractedJSON.beforeid;
                          const beforeframetime = extractedJSON.beforeframetime;
                          const beforesnapshottime = extractedJSON.beforesnapshottime;
                      
                          const aftercamera = extractedJSON.aftercamera;
                          const afterlabel = extractedJSON.afterlabel;
                          const aftersnapshot_time = extractedJSON.aftersnapshot_time;
                          const afterid = extractedJSON.afterid;
                          const eventtype = extractedJSON.eventtype;
                          //var data = getState('mqtt.0.frigate.carport.person.snapshot').val;
                          if (eventtype == 'update') {console.log('Script: Status_cctv Event: | '+eventtype+' | '+beforecamera+' | '+beforeid+' | '+beforelabel+' | '+beforeframetime+' | '+beforesnapshottime);}
                          if (eventtype == 'new') {console.log('Script: Status_cctv Event: | '+eventtype+' | '+beforecamera+' | '+beforeid+' | '+beforelabel+' | '+beforeframetime+' | '+beforesnapshottime);}
                          if (eventtype == 'end') {
                          exec('wget -O '+dest_path+beforeid+'.jpg http://cctv-prod.fritz.box:5000/api/events/'+beforeid+'/snapshot.jpg');
                          exec('wget -O '+dest_path+beforecamera+'-'+beforeid+'.jpg http://cctv-prod.fritz.box:5000/clips/'+beforecamera+'-'+beforeid+'.jpg');
                      
                          //getBinaryState(idPic, async function (err, data){
                          //    fs.writeFile('test.jpg', data, function (err) {
                          //        if(err) log('Fehler!');
                          //    });                
                          //});
                          
                          whole_path = dest_path;
                          whole_path += beforecamera;
                          whole_path += '-';
                          whole_path += beforeid;
                          whole_path += '.jpg';
                          
                          //fs.writeFile(whole_path, data, (err) => {if (err) throw err;console.log('File written ' + whole_path);});
                          
                          sendTo("email", "send", {
                              text: (['Script: Status_cctv Event: '+eventtype,'\n','Label:'+beforelabel,'\n','Camera:'+beforecamera,'\n','Eventtype:'+eventtype,'\n','Frame Time:'+beforeframetime,'\n','Snapshot Time:'+beforesnapshottime].join('')),
                              to: 'john@doe.cc',
                              subject: 'Script: Status_cctv Event: '+eventtype+' Camera:'+beforecamera+' Label:'+beforelabel+' v9',
                              attachments:[
                                  {path: dest_path+beforecamera+'-'+beforeid+'.jpg', cid: "file1"}
                                  //{path: dest_path+beforeid+'.jpg', cid: "file2"},
                                  ]
                          });
                          console.log('Script: Status_cctv Event: | '+eventtype+' | '+beforecamera+' | '+beforeid+' | '+beforelabel+' | '+beforeframetime+' | '+beforesnapshottime);
                          exec('/usr/bin/rm -f '+dest_path+beforecamera+'-'+beforeid+'.jpg');
                          exec('/usr/bin/rm -f '+dest_path+beforeid+'.jpg');
                          
                          //sendTo("pushover.0", "send", {
                          //    message: 'Script: Status_cctv Event: changed',
                          //    sound: ""
                          //});
                      
                          }
                      });
                      
                      Rob_inR Offline
                      Rob_inR Offline
                      Rob_in
                      wrote on last edited by
                      #39

                      Hi all, has anyone managed to make this work?

                      For months I have been using a an MQTT topic change trigger to send an image (via Telegram) that was fetched via HTTP from http://frigate/api/myCam/latest.jpg?bbox=1 Works well, but...

                      I have just done a lot of work adding new cameras and configuration to Frigate and want to take advantage of it's MQTT image publishing. It seems silly to fetch something via HTTP when an image can be pushed via MQTT is all.

                      Surely there is an easy solution? So why can I not find it? :(

                      WalW Rob_inR 2 Replies Last reply
                      0
                      • Rob_inR Rob_in

                        Hi all, has anyone managed to make this work?

                        For months I have been using a an MQTT topic change trigger to send an image (via Telegram) that was fetched via HTTP from http://frigate/api/myCam/latest.jpg?bbox=1 Works well, but...

                        I have just done a lot of work adding new cameras and configuration to Frigate and want to take advantage of it's MQTT image publishing. It seems silly to fetch something via HTTP when an image can be pushed via MQTT is all.

                        Surely there is an easy solution? So why can I not find it? :(

                        WalW Offline
                        WalW Offline
                        Wal
                        Developer
                        wrote on last edited by
                        #40

                        @rob_in ,
                        if you can make your frigate folder available in ioBroker (mount, samba, etc.) you can use that.

                        Gruß
                        Walter

                        DoorIO-Adapter
                        wioBrowser-Adapter und wioBrowser

                        1 Reply Last reply
                        0
                        • Rob_inR Rob_in

                          Hi all, has anyone managed to make this work?

                          For months I have been using a an MQTT topic change trigger to send an image (via Telegram) that was fetched via HTTP from http://frigate/api/myCam/latest.jpg?bbox=1 Works well, but...

                          I have just done a lot of work adding new cameras and configuration to Frigate and want to take advantage of it's MQTT image publishing. It seems silly to fetch something via HTTP when an image can be pushed via MQTT is all.

                          Surely there is an easy solution? So why can I not find it? :(

                          Rob_inR Offline
                          Rob_inR Offline
                          Rob_in
                          wrote on last edited by
                          #41

                          @rob_in said in JS-MQTT DP eines Bildes (JFIF) in Datei schreiben (jpg):

                          For months I have been using a an MQTT topic change trigger to send an image (via Telegram) that was fetched via HTTP from http://frigate/api/myCam/latest.jpg?bbox=1 Works well, but...

                          I have just done a lot of work adding new cameras and configuration to Frigate and want to take advantage of it's MQTT image publishing. It seems silly to fetch something via HTTP when an image can be pushed via MQTT is all.

                          Surely there is an easy solution? So why can I not find it? :(

                          Having messed around with this a bit have discovered I was doing it correctly in the first place.

                          Turns out that images published through MQTT are not what I want anyhow so best ignored. Doh!

                          See: https://github.com/blakeblackshear/frigate/issues/6241

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          616

                          Online

                          32.6k

                          Users

                          82.3k

                          Topics

                          1.3m

                          Posts
                          Community
                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                          ioBroker Community 2014-2025
                          logo
                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Home
                          • Recent
                          • Tags
                          • Unread 0
                          • Categories
                          • Unreplied
                          • Popular
                          • GitHub
                          • Docu
                          • Hilfe