Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Action URL - Info an ioBroker per http senden

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Action URL - Info an ioBroker per http senden

    This topic has been deleted. Only users with topic management privileges can see it.
    • bahnuhr
      bahnuhr Forum Testing Most Active @marsmännchen last edited by

      @marsmännchen

      anbei mein Scriptbaustein:

              fs.writeFile('/opt/iobroker/iobroker-data/tmp/snap' + ip + '.jpg', body, 'binary', function(err) {
              if (err) {
                  console.error(err);
              } else {
                  log('Snapshot sent '+ ip);
                  sendTo('telegram.0', {user: vUser, text: '/opt/iobroker/iobroker-data/tmp/snap' + ip + '.jpg', caption: cam});
              }
            }); 
      

      Bitte vergleichen.

      1 Reply Last reply Reply Quote 0
      • Asgothian
        Asgothian Developer @marsmännchen last edited by Asgothian

        @marsmännchen sagte in Action URL - Info an ioBroker per http senden:

        Findet jemand den Fehler??

        telegram macht genau das was du ihm sagst. Per SendTo schickst du einen Text, nämlich '/tmp/snap-pi.jpg'. Genau das wird angezeigt.

        Du musst im SendTo schon irgendwie (wie weiss ich nicht, Telegram gibts bei mir nicht) sagen das das was du da übergibst eine Pfad ist und das du senden willst was sich an der Stelle befindet, nicht den Text selber.

        War Blödsinn - sorry 🙂

        A.

        bahnuhr 1 Reply Last reply Reply Quote 1
        • bahnuhr
          bahnuhr Forum Testing Most Active @Asgothian last edited by bahnuhr

          @asgothian sagte in Action URL - Info an ioBroker per http senden:

          Per SendTo schickst du einen Text

          siehe mein Script.
          Es steht zwar Text; aber es wird das Bild gesendet.

          Auszug aus Hilfeseite:
          8268358d-339e-4233-ae59-09e60af1b97e-image.png

          Vielleicht stimmt auch einfach dein Pfad nicht !

          JohGre 1 Reply Last reply Reply Quote 1
          • JohGre
            JohGre @bahnuhr last edited by

            @marsmännchen Ich hatte das selbe Verhalten weil der User ioBroker keinen Zugriff auf das Verzeichnis hatte. Kontrolliere das doch mal

            1 Reply Last reply Reply Quote 0
            • F
              Flixer last edited by

              Hallo in die Runde,

              mal als Gedankengang und Hilfestellung unter diesem Link schauen:

              https://forum.iobroker.net/topic/51648/dateien-auf-ftp-nas-kopieren-und-anschließend-umbenennen/6

              Im letzten Post habe ich das fertige und funktionstüchtige Blockly als Bild beigefügt. Das funktioniert und ich finde es "elegant" den Text mit Bausteinen zu erstellen. Wenn man mehrere Kameras hat, dann lässt es sich gut vervielfältigen.

              MfG Flixer

              1 Reply Last reply Reply Quote 1
              • BananaJoe
                BananaJoe Most Active @marsmännchen last edited by

                @marsmännchen hier mein Blockly als JavaScript:

                on({id: 'zigbee.0.00158d00049fe012.opened', change: "ne"}, async function (obj) {
                  var value = obj.state.val;
                  var oldValue = obj.oldState.val;
                  if (Entpreller1 == 0) {
                    (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
                    Entpreller1 = 1;
                    Zeitstempel = (obj.state ? obj.state.ts : "");
                    setState("javascript.0.vis.0.main.Briefkasten.KlappeBewegt"/*KlappeBewegt*/, true);
                    setState("javascript.0.vis.0.main.Briefkasten.Zeitstempel"/*javascript.0.vis.0.main.Briefkasten.Zeitstempel*/, formatDate(getDateObject(Zeitstempel), "WW SS:mm:ss"));
                    exec((['wget --output-document /tmp/Cam215Briefkasten.jpg \'','http://192.168.1.215/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=IchbineingeilerTypp&user=admin&password=znil2001','\''].join('')), async function (error, result, stderr) {
                        sendTo("telegram", "send", {
                          text: ('Briefkasten um: ' + String(formatDate(new Date(), "hh:mm:ss"))),
                          disable_notification: true
                      });
                      sendTo("telegram", "send", {
                          text: '/tmp/Cam215Briefkasten.jpg'
                      });
                    });
                    console.log("exec: " + (['wget --output-document /tmp/Cam215Briefkasten.jpg \'','http://192.168.1.215/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=IchbineingeilerTypp&user=admin&password=znil2001','\''].join('')));
                    setStateDelayed('javascript.0.vis.0.main.STATUS-View-in-Widget.01_Briefkasten', true, false, parseInt(((500) || "").toString(), 10), false);
                    setStateDelayed('javascript.0.vis.0.main.STATUS-View-in-Widget.Statusnummer', 1, false, parseInt(((20000) || "").toString(), 10), false);
                    timeout = setTimeout(async function () {
                      Entpreller1 = 0;
                    }, 8000);
                  }
                });
                

                Der Knackpunkt scheint zu sein wie du den Text übergibst (das text: { })

                1 Reply Last reply Reply Quote 1
                • M
                  marsmännchen last edited by

                  @bananajoe nein, hab ich dann das selbe problem, danke trotzdem

                  zur Thorie des falschen pfades:
                  capture2.JPG
                  capture1.JPG

                  pi@achbotslave:/tmp $ ls
                  snap-pi1.jpg //nur zu testzwecke, ich weiss das ich snap-pi.jpg im skript stehen hab
                  snap-pi.jpg
                  

                  das ist sicher nicht der Fall traue ich mich zu behaupten.

                  Wenn ich dein Script als Vorlage nehme @bahnuhr

                  var request = require('request');
                  var fs      = require('fs');
                   
                  function sendImage() {
                      request.get({url: 'http://192.168.1.191:8765/picture/2/current/', encoding: 'binary'}, function (err, response, body) {
                          fs.writeFile('/opt/iobroker/iobroker-data/tmp/snap' + ip + '.jpg', body, 'binary', function(err) {
                   
                         if (err) {
                              console.error(err);
                          } else {
                              log('Snapshot sent '+ ip);
                              sendTo('telegram.0', {user: vUser, text: '/opt/iobroker/iobroker-data/tmp/snap' + ip + '.jpg', caption: cam});
                          }
                        }); 
                      });
                  }
                  on("0_userdata.0.example_state"/*Variablen.Pi1-detection*/, function (obj) {
                      if (obj.state.val) {
                          // send 4 images: immediately, in 5, 15 and 30 seconds
                          sendImage();
                          setTimeout(sendImage, 2000);
                         // setTimeout(sendImage, 10000);
                         // setTimeout(sendImage, 15000);
                      }
                  });
                   fs.writeFile('/opt/iobroker/iobroker-data/tmp/snap' + ip + '.jpg', body, 'binary', function(err) {
                          if (err) {
                              console.error(err);
                          } else {
                              log('Snapshot sent '+ ip);
                              sendTo('telegram.0', {user: vUser, text: '/opt/iobroker/iobroker-data/tmp/snap' + ip + '.jpg', caption: cam});
                          }
                        }); 
                  

                  dann sagt er:

                  12:57:16.635	error	javascript.1 (27902) script.js.common.test01: ReferenceError: ip is not defined
                  12:57:16.636	error	javascript.1 (27902) at script.js.common.test01:26:56
                  12:57:16.637	error	javascript.1 (27902) at script.js.common.test01:34:3
                  

                  Also für mich kein wirklicher Vergleich, muss ich versuchen es zu verändern und da ist die Fehleranfälligkeit als Anfänger wieder sehr hoch.
                  Will sagen, es dauert wohl ein bisschen.
                  Vorher will ich die Theorie von @JohGre überprüfen, da ich ja das Bild mit Filezilla dort finde wo ich es gespeichert habe, und ich nach
                  dem "Auszug aus der Hilfeseite " vorgegangen bin.
                  @JohGre weisst du vielleicht wie ich das überprüfe auf die schnelle? irgendwas mit chmod?

                  JohGre 1 Reply Last reply Reply Quote 0
                  • JohGre
                    JohGre @marsmännchen last edited by

                    @marsmännchen sagte in Action URL - Info an ioBroker per http senden:

                    irgendwas mit chmod?

                    sudo chown iobroker:iobroker bild.jpg mittels ls - l siehst du die aktuelle Berechtigung

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      marsmännchen @JohGre last edited by

                      @johgre

                      pi@achbotslave:/tmp $ ls -l
                      insgesamt 580
                      drwx------ 3 squeezeboxserver nogroup    4096 18. Jän 18:52 par-73717565657a65626f78736572766572
                      -rw-r--r-- 1 iobroker         iobroker 298222 26. Jän 09:18 snap-pi1.jpg
                      -rw-r--r-- 1 iobroker         iobroker 276558 26. Jän 13:33 snap-pi.jpg
                      drwx------ 3 root             root       4096 18. Jän 18:52 systemd-private-dfd1a3af5eb24b8c899f4cc4142c9656-grafana-server.service-LFsQ0e
                      drwx------ 3 root             root       4096 18. Jän 18:51 systemd-private-dfd1a3af5eb24b8c899f4cc4142c9656-systemd-logind.service-K0IgHi
                      drwx------ 3 root             root       4096 26. Jän 03:37 systemd-private-dfd1a3af5eb24b8c899f4cc4142c9656-systemd-timesyncd.service-UlRPtg
                      
                      

                      rw sieht nach berechtigt aus wenn ich nicht irre...

                      JohGre 1 Reply Last reply Reply Quote 0
                      • JohGre
                        JohGre @marsmännchen last edited by

                        @marsmännchen sieht genauso aus wie bei mir, sollte passen

                        1 Reply Last reply Reply Quote 1
                        • M
                          marsmännchen last edited by

                          @johgre
                          ok,danke. keine Ahnung

                          M 1 Reply Last reply Reply Quote 0
                          • M
                            marsmännchen @marsmännchen last edited by

                            Endlich geschafft:
                            Für die Nachwelt:

                            Vielleicht für einen iobroker Profi eh klar.

                            Folgendes habe ich geändert:

                            Das Script vom Host weg in den Master-Raspberry, und das Script dort nicht im "Common" sondern "Root".
                            Danke euch für die Hilfe!!
                            MfG
                            Patrick

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

                            Support us

                            ioBroker
                            Community Adapters
                            Donate
                            FAQ Cloud / IOT
                            HowTo: Node.js-Update
                            HowTo: Backup/Restore
                            Downloads
                            BLOG

                            951
                            Online

                            31.9k
                            Users

                            80.2k
                            Topics

                            1.3m
                            Posts

                            8
                            26
                            3119
                            Loading More Posts
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes
                            Reply
                            • Reply as topic
                            Log in to reply
                            Community
                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                            The ioBroker Community 2014-2023
                            logo