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. JavaScript
  5. Tuya Doorbell Script

NEWS

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

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

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.2k

Tuya Doorbell Script

Geplant Angeheftet Gesperrt Verschoben JavaScript
communicationjavascriptmultimedia
4 Beiträge 2 Kommentatoren 358 Aufrufe 2 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.
  • ? Offline
    ? Offline
    Ein ehemaliger Benutzer
    schrieb am zuletzt editiert von Ein ehemaliger Benutzer
    #1

    Hi, ich verwende folgendes Script, um mir das Bild von der Doorbell per Synology-Chat schicken zu lassen.
    Das hat auch mal gut funktioniert, auf einmal wird aber das Bild in /synology/Doorbell.jpg nicht mehr ueberschrieben, er schickt mir immer das gleiche Bild.. :-(
    Loesche ich es mit der Hand, dann stimmt das naechste wieder, aber dann wieder nicht mehr..

    Hat jemand ne Idee, was das sein koennte? Hab so die Timeouts in Verdacht.. ??

    @Glasfaser war das Script so aehnlich von dir?

    var URL_Chat, URL_ioBroker, URL_Snapshot, Nachricht, timeout, send, timeout2, result;
    
    async function Bild_holen() {
          request({url: URL_Snapshot,encoding: null,},
              (error, response, body) => {if (!error && body) {writeFile("0_userdata.0", "/synology/Doorbell.jpg", body, error);
           }
         }
         );
        }
    
    
    URL_Chat = 'http://192.168.0.63:5000/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=SYNOTOKEN&payload={"text":"';
    URL_ioBroker = 'http://192.168.3.41:81/0_userdata.0/synology/Doorbell.jpg';
    URL_Snapshot = getState('tuya.0.bf72e9be420184d658hjd0.154'/*doorbell pic*/).val;
    Nachricht = 'Camera Doorbell:';
    
    on({id: 'tuya.0.bf72e9be420184d658hjd0.154', change: "any"}, async function (obj) {
      var value = obj.state.val;
      var oldValue = obj.oldState.val;
      await Bild_holen();
    
     (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
     (function () {if (timeout2) {clearTimeout(timeout2); timeout2 = null;}})();
      
      timeout = setTimeout(async function () {
       send = [URL_Chat,String(Nachricht) + '", "file_url": "',URL_ioBroker,'"}'].join('');
       timeout2 = setTimeout(async function () {
          try {
           require("request")(send, async function (error, response, result) {
             console.log(result);
            }).on("error", function (e) {console.error(e);});
          } catch (e) { console.error(e); }
         console.log(send);
          }, 1000);
      }, 2000);
     });
    
    
    GlasfaserG 1 Antwort Letzte Antwort
    0
    • ? Ein ehemaliger Benutzer

      Hi, ich verwende folgendes Script, um mir das Bild von der Doorbell per Synology-Chat schicken zu lassen.
      Das hat auch mal gut funktioniert, auf einmal wird aber das Bild in /synology/Doorbell.jpg nicht mehr ueberschrieben, er schickt mir immer das gleiche Bild.. :-(
      Loesche ich es mit der Hand, dann stimmt das naechste wieder, aber dann wieder nicht mehr..

      Hat jemand ne Idee, was das sein koennte? Hab so die Timeouts in Verdacht.. ??

      @Glasfaser war das Script so aehnlich von dir?

      var URL_Chat, URL_ioBroker, URL_Snapshot, Nachricht, timeout, send, timeout2, result;
      
      async function Bild_holen() {
            request({url: URL_Snapshot,encoding: null,},
                (error, response, body) => {if (!error && body) {writeFile("0_userdata.0", "/synology/Doorbell.jpg", body, error);
             }
           }
           );
          }
      
      
      URL_Chat = 'http://192.168.0.63:5000/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=SYNOTOKEN&payload={"text":"';
      URL_ioBroker = 'http://192.168.3.41:81/0_userdata.0/synology/Doorbell.jpg';
      URL_Snapshot = getState('tuya.0.bf72e9be420184d658hjd0.154'/*doorbell pic*/).val;
      Nachricht = 'Camera Doorbell:';
      
      on({id: 'tuya.0.bf72e9be420184d658hjd0.154', change: "any"}, async function (obj) {
        var value = obj.state.val;
        var oldValue = obj.oldState.val;
        await Bild_holen();
      
       (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
       (function () {if (timeout2) {clearTimeout(timeout2); timeout2 = null;}})();
        
        timeout = setTimeout(async function () {
         send = [URL_Chat,String(Nachricht) + '", "file_url": "',URL_ioBroker,'"}'].join('');
         timeout2 = setTimeout(async function () {
            try {
             require("request")(send, async function (error, response, result) {
               console.log(result);
              }).on("error", function (e) {console.error(e);});
            } catch (e) { console.error(e); }
           console.log(send);
            }, 1000);
        }, 2000);
       });
      
      
      GlasfaserG Offline
      GlasfaserG Offline
      Glasfaser
      schrieb am zuletzt editiert von Glasfaser
      #2

      @ilovegym sagte in Tuya Doorbell Script:

      Loesche ich es mit der Hand,

      ich lösche es per :

      unlink('0_userdata.0', 'synology/bild1.jpg',(e)=>{
      
          if(e) log(e)
      
      })
      

      var URL_Chat, URL_ioBroker, URL_Snapshot, Nachricht, timeout, send, timeout2, timeout3, result;
      
      // Beschreibe diese Funktion …
      async function loesche_Bild() {
         unlink('0_userdata.0', 'synology/bild1.jpg',(e)=>{
         
             if(e) log(e)
         
         })
         
      
      }
      
      // Beschreibe diese Funktion …
      async function Bild_holen() {
         
         
         
         request(
         
           {
         
             url: URL_Snapshot ,
         
             encoding: null,
         
           },
         
           (error, response, body) => {
         
             if (!error && body) timeout7 = setTimeout(function (){
         
               writeFile("0_userdata.0", "/synology/bild1.jpg", body);
         
             }, 3000);
         
           }
         
         );
         
      
      }
      
      
      URL_Chat = 'http://192.168.xxx.xx:5000/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=xxxxxxxxxxxxxxxxxx&payload={"text":"';
      URL_ioBroker = 'http://192.168.xxx.xx:8082/0_userdata.0/synology/bild1.jpg';
      URL_Snapshot = getState("synology.0.SurveillanceStation.cameras.Haustür.linkSnapshot").val;
      Nachricht = 'Es klingelt an der Haustuer';
      on({id: 'default', change: "ne"}, async function (obj) {
       var value = obj.state.val;
       var oldValue = obj.oldState.val;
       await Bild_holen();
       (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
       (function () {if (timeout2) {clearTimeout(timeout2); timeout2 = null;}})();
       timeout = setTimeout(async function () {
         send = [URL_Chat,String(Nachricht) + '", "file_url": "',URL_ioBroker,'"}'].join('');
         timeout2 = setTimeout(async function () {
           try {
             require("request")(send, async function (error, response, result) {
               console.log(result);
             }).on("error", function (e) {console.error(e);});
           } catch (e) { console.error(e); }
           timeout3 = setTimeout(async function () {
             await loesche_Bild();
           }, 7000);
           console.log(send);
         }, 4000);
       }, 2000);
      });
      

      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 ..

      ? 1 Antwort Letzte Antwort
      0
      • GlasfaserG Glasfaser

        @ilovegym sagte in Tuya Doorbell Script:

        Loesche ich es mit der Hand,

        ich lösche es per :

        unlink('0_userdata.0', 'synology/bild1.jpg',(e)=>{
        
            if(e) log(e)
        
        })
        

        var URL_Chat, URL_ioBroker, URL_Snapshot, Nachricht, timeout, send, timeout2, timeout3, result;
        
        // Beschreibe diese Funktion …
        async function loesche_Bild() {
           unlink('0_userdata.0', 'synology/bild1.jpg',(e)=>{
           
               if(e) log(e)
           
           })
           
        
        }
        
        // Beschreibe diese Funktion …
        async function Bild_holen() {
           
           
           
           request(
           
             {
           
               url: URL_Snapshot ,
           
               encoding: null,
           
             },
           
             (error, response, body) => {
           
               if (!error && body) timeout7 = setTimeout(function (){
           
                 writeFile("0_userdata.0", "/synology/bild1.jpg", body);
           
               }, 3000);
           
             }
           
           );
           
        
        }
        
        
        URL_Chat = 'http://192.168.xxx.xx:5000/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=xxxxxxxxxxxxxxxxxx&payload={"text":"';
        URL_ioBroker = 'http://192.168.xxx.xx:8082/0_userdata.0/synology/bild1.jpg';
        URL_Snapshot = getState("synology.0.SurveillanceStation.cameras.Haustür.linkSnapshot").val;
        Nachricht = 'Es klingelt an der Haustuer';
        on({id: 'default', change: "ne"}, async function (obj) {
         var value = obj.state.val;
         var oldValue = obj.oldState.val;
         await Bild_holen();
         (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
         (function () {if (timeout2) {clearTimeout(timeout2); timeout2 = null;}})();
         timeout = setTimeout(async function () {
           send = [URL_Chat,String(Nachricht) + '", "file_url": "',URL_ioBroker,'"}'].join('');
           timeout2 = setTimeout(async function () {
             try {
               require("request")(send, async function (error, response, result) {
                 console.log(result);
               }).on("error", function (e) {console.error(e);});
             } catch (e) { console.error(e); }
             timeout3 = setTimeout(async function () {
               await loesche_Bild();
             }, 7000);
             console.log(send);
           }, 4000);
         }, 2000);
        });
        

        ? Offline
        ? Offline
        Ein ehemaliger Benutzer
        schrieb am zuletzt editiert von
        #3

        @glasfaser

        Danke, aber es mag nicht…

        Wenn ich mir das Bild mit wget nach /opt/iobroker/pics/Doorbell.jpg hole, das klappt.
        Von dort kann ich es ja nicht an den Chat senden, es muss ja nach userdata/xxx …
        Hmpf

        GlasfaserG 1 Antwort Letzte Antwort
        0
        • ? Ein ehemaliger Benutzer

          @glasfaser

          Danke, aber es mag nicht…

          Wenn ich mir das Bild mit wget nach /opt/iobroker/pics/Doorbell.jpg hole, das klappt.
          Von dort kann ich es ja nicht an den Chat senden, es muss ja nach userdata/xxx …
          Hmpf

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

          @ilovegym

          Hast du mal mein Script genutzt !?

          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 ..

          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

          727

          Online

          32.6k

          Benutzer

          82.2k

          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