NEWS
Tuya Doorbell Script
-
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); }); -
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); }); -
@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) })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 -
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