Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Bei Timeout den Überblick verloren - Klingelscript

    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

    Bei Timeout den Überblick verloren - Klingelscript

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

      Hallo allerseits,

      ich habe seit einiger Zeit mein Script für dei Türklingel am laufen.

      Dabei wird unmittelbar bei Klingeln ein Snapshot per mail versendet.

      Jetzt wollte ich das erweitern das 6 Sekunden später ein weiteres Bild erstellen.

      Aber mittlerweile habe ich so viele Timeout Schleifen drin das ich da komplett den Überblick verloren habe.

      Es wird jedenfalls zweimal das gleiche Bild versendet.

      Hat jemand eine Idee wo ich meinen Fehler gemacht habe?:

      var sperre = false;  //verhindert das doppeltes Drücken das Script stoppt
      
      on({id: 'sonoff.0.Eingang.POWER2', change: "any"}, function (obj) {
        if(!sperre) {
          sperre = true;
           sendTo('phantomjs.0', 'send', {
          url:                    'http://192.168.8.95:8765/picture/2/current/?_username=xxxx&_signature=52634d7b92e34c0b5c865eeb8e3d5935741934ad',
          output:                 'picture.png',  // default value
          width:                  800,            // default value
          height:                 600,            // default value
          timeout:                2000,           // default value
          zoom:                   1,              // default value
      
          'clip-top':             0,              // default value
          'clip-left':            0,              // default value
          'clip-width':           800,            // default value is equal to width
          'clip-height':          600,            // default value is equal to height
          'scroll-top':           0,              // default value
          'scroll-left':          0,              // default value
      
          online:                 true           // default value
      }, function (result) {
          if (result.error) {
              console.error(JSON.stringify(result.error));
          }
          if (result.stderr) {
              console.error(result.stderr);
          }
          if (result.stdout) {
              console.log(result.stdout);
          }
          console.log(result.output);
      
      });
      timeout = setTimeout(function () {
      sendTo("email", "send", {
           text: '',
           to: 'xxxx@gmail.com',
           subject: 'Klingel',
           attachments:[
              {path: '/opt/iobroker/node_modules/iobroker.phantomjs/picture.png', cid: "file1"},
            ]
      
       }); //Mail mit Bild Empfänger 1
       sendTo("email", "send", {
           text: '',
           to: 'xxxx@gmail.com',
           subject: 'Klingel',
           attachments:[
              {path: '/opt/iobroker/node_modules/iobroker.phantomjs/picture.png', cid: "file1"},
            ]
      
       }); //Mail mit Bild Empfänger 2
       }, 5000); // Verzögert den Mailversand bis das Bild gespeichert ist
      
           setState("vis.0.control.command", '{"instance": "FFFFFFFF", "command": "changeView", "data": "Neu/Tuer"}'); 
                 // oder
                 //setState("vis.0.control.instance", 'FFFFFFFF');
                 //setState("vis.0.control.data",     'DemoView');
                 //setState("vis.0.control.command",  'changeView'); // muss immer letzte sein
      
                 // Setze View auf Kamerabild
                 setTimeout(function () {
                            setState("vis.0.control.command", '{"instance": "FFFFFFFF", "command": "changeView", "data": "Neu/Info"}');
                 }, 60000); // Nach 60 Sekunden, zeige wieder Start View
          setState("tr-064.0.states.ring"/*ring*/, '**611, 15'); //Klingelt 15 Sekunden auf dem Telefon
          sendTo("pushover", "send", {
             message: 'Klingel',
                file: "/opt/iobroker/node_modules/iobroker.phantomjs/picture.png",   
                sound: ""
          }); //Klingelinfo über Pushover
          timeout = setTimeout(function () {
          setState("alexa2.0.Echo-Devices.G2A0PxxxxLLE.Player.volume"/*volume*/, 90, true);
          }, 500); // Setzt Alexa auf 90%
          timeout = setTimeout(function () {
          setState("alexa2.0.Echo-Devices.G2A0PxxxxLLE.Commands.speak"/*speak*/, 'Es ist jemand an der Tür');
          }, 1000); // Sprachansage
          timeout = setTimeout(function () {
          setState("alexa2.0.Echo-Devices.G2A0PxxxxLLE.Player.volume"/*volume*/, 50, true);
          }, 1500); // Setzt Alexa auf 50%
      
          timeout = setTimeout(function () {
      sendTo('phantomjs.0', 'send', {
          url:                    'http://192.168.8.95:8765/picture/2/current/?_username=xxxx             'picture.png',  // default value
          width:                  800,            // default value
          height:                 600,            // default value
          timeout:                2000,           // default value
          zoom:                   1,              // default value
      
          'clip-top':             0,              // default value
          'clip-left':            0,              // default value
          'clip-width':           800,            // default value is equal to width
          'clip-height':          600,            // default value is equal to height
          'scroll-top':           0,              // default value
          'scroll-left':          0,              // default value
      
          online:                 true           // default value
      }, function (result) {
          if (result.error) {
              console.error(JSON.stringify(result.error));
          }
          if (result.stderr) {
              console.error(result.stderr);
          }
          if (result.stdout) {
              console.log(result.stdout);
          }
          console.log(result.output);
      
      });
      }, 6000); 
      timeout = setTimeout(function () {
      sendTo("email", "send", {
           text: '',
           to: 'xxxx@gmail.com',
           subject: 'Klingel',
           attachments:[
              {path: '/opt/iobroker/node_modules/iobroker.phantomjs/picture.png', cid: "file1"},
            ]
      
       }); //Mail mit Bild Empfänger 1
       sendTo("email", "send", {
           text: '',
           to: 'xxxx@gmail.com',
           subject: 'Klingel',
           attachments:[
              {path: '/opt/iobroker/node_modules/iobroker.phantomjs/picture.png', cid: "file1"},
            ]
      
       }); //Mail mit Bild Empfänger 2
       }, 5000); // Verzögert den Mailversand bis das Bild gespeichert ist
      
          setTimeout(function() {
             sperre = false;
          }, 5000); //Zeit für Klingelsperre 1.Zeile
        }  
      });
      
      
      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      Support us

      ioBroker
      Community Adapters
      Donate

      904
      Online

      31.8k
      Users

      79.9k
      Topics

      1.3m
      Posts

      1
      1
      123
      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