<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[Gelöst] Http Befehl toggle scheint der falsche zu sein]]></title><description><![CDATA[<p dir="auto">Hallo zusammen</p>
<p dir="auto">Brauche nun auch mal Eure Hilfe. Ich habe mir mit Hilfe dieses Forums ein Skript zusammen gebaut. Das schaut wie folgt aus:</p>
<pre><code>var request = require('request');
var fs      = require('fs');

function sendImage() {
    request.get({url: 'http://IP/snap.jpeg', encoding: 'binary'}, function (err, response, body) {
        fs.writeFile("/opt/snap.jpg", body, 'binary', function(err) {

        if (err) {
            console.error(err);
        } else {
            console.log('Snapshot sent');
            sendTo('telegram.0', {text: 'Es hat soeben geklingelt!'});
            sendTo('telegram.0', '/opt/snap.jpg');
            //sendTo('telegram.0', {text: '/opt/snap.jpg', caption: 'Snapshot'});
        }
      });
    });
}
on("javascript.0.Geklingelt", function (obj) {
    if (obj.state.val) {
        // send 4 images: immediately, in 5, 15 and 30 seconds
        sendImage();
        setTimeout(sendImage, 5000);
        setTimeout(sendImage, 15000);
        setTimeout(sendImage, 30000);
    }
</code></pre>
<p dir="auto">Das Skript funktioniert soweit. Mein Problem liegt beim Triggern des Skripts. Wie Ihr seht wird das Skript beim verändern des Datenpunktes "javascript.0.Geklingelt" gestartet. Der Auslöser dazu ist ein http Befehl.</p>
<p dir="auto">Dieser ist wie folgt:<br />
<a href="http://IP:8087/toggle/javascript.0.Geklingelt" rel="nofollow ugc">http://IP:8087/toggle/javascript.0.Geklingelt</a></p>
<p dir="auto">Leider wird das Skript nur bei jedem 2. Klingeln gestartet. Muss ich anstatt toggle einen anderen Befehl wählen? Die Frage ist nur welcher und wie muss der http Befehl dann lauten?</p>
<p dir="auto">Danke für Eure Hilfe.</p>
<p dir="auto">Gruss</p>
]]></description><link>https://forum.iobroker.net/topic/30831/gelöst-http-befehl-toggle-scheint-der-falsche-zu-sein</link><generator>RSS for Node</generator><lastBuildDate>Sat, 02 May 2026 09:51:31 GMT</lastBuildDate><atom:link href="https://forum.iobroker.net/topic/30831.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 04 Mar 2020 16:06:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [Gelöst] Http Befehl toggle scheint der falsche zu sein on Wed, 04 Mar 2020 21:04:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/drapo" aria-label="Profile: drapo">@<bdi>drapo</bdi></a> sagte:</p>
<blockquote>
<p dir="auto">Funktioniert einwandfrei.</p>
</blockquote>
<p dir="auto">Dann markiere bitte das Thema in der Überschrift des ersten Beitrags als [gelöst].</p>
]]></description><link>https://forum.iobroker.net/post/388725</link><guid isPermaLink="true">https://forum.iobroker.net/post/388725</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Wed, 04 Mar 2020 21:04:07 GMT</pubDate></item><item><title><![CDATA[Reply to [Gelöst] Http Befehl toggle scheint der falsche zu sein on Wed, 04 Mar 2020 20:36:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> hast recht. hatte noch einen Fehler drin. Funktioniert einwandfrei. Vielen Dank für die Hilfe.</p>
]]></description><link>https://forum.iobroker.net/post/388711</link><guid isPermaLink="true">https://forum.iobroker.net/post/388711</guid><dc:creator><![CDATA[drapo]]></dc:creator><pubDate>Wed, 04 Mar 2020 20:36:07 GMT</pubDate></item><item><title><![CDATA[Reply to [Gelöst] Http Befehl toggle scheint der falsche zu sein on Wed, 04 Mar 2020 20:19:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/drapo" aria-label="Profile: drapo">@<bdi>drapo</bdi></a> sagte:</p>
<blockquote>
<p dir="auto">Jetzt läuft es gar nicht mehr.</p>
</blockquote>
<p dir="auto">Dann hast Du einen Fehler eingebaut. Der Trigger muss bei jeder Wertänderung (toggle) auslösen. Oder hast Du das Kommando geändert ?</p>
<blockquote>
<p dir="auto">Dieser ist wie folgt:<br />
<a href="http://IP:8087/toggle/javascript.0.Geklingelt" rel="nofollow ugc">http://IP:8087/toggle/javascript.0.Geklingelt</a></p>
</blockquote>
]]></description><link>https://forum.iobroker.net/post/388695</link><guid isPermaLink="true">https://forum.iobroker.net/post/388695</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Wed, 04 Mar 2020 20:19:19 GMT</pubDate></item><item><title><![CDATA[Reply to [Gelöst] Http Befehl toggle scheint der falsche zu sein on Wed, 04 Mar 2020 20:14:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> geht leider nicht. Jetzt läuft es auch jedes 2. Mal nicht mehr. Jetzt läuft es gar nicht mehr. Sonst noch jemand einen Tip?</p>
]]></description><link>https://forum.iobroker.net/post/388693</link><guid isPermaLink="true">https://forum.iobroker.net/post/388693</guid><dc:creator><![CDATA[drapo]]></dc:creator><pubDate>Wed, 04 Mar 2020 20:14:15 GMT</pubDate></item><item><title><![CDATA[Reply to [Gelöst] Http Befehl toggle scheint der falsche zu sein on Wed, 04 Mar 2020 16:31:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/drapo" aria-label="Profile: drapo">@<bdi>drapo</bdi></a> sagte:</p>
<blockquote>
<p dir="auto">Leider wird das Skript nur bei jedem 2. Klingeln gestartet.</p>
</blockquote>
<p dir="auto">Lass die Abfrage in Zeile 20 weg</p>
<pre><code>on("javascript.0.Geklingelt", function () {
        // send 4 images: immediately, in 5, 15 and 30 seconds
        sendImage();
        setTimeout(sendImage, 5000);
        setTimeout(sendImage, 15000);
        setTimeout(sendImage, 30000);
});
</code></pre>
]]></description><link>https://forum.iobroker.net/post/388558</link><guid isPermaLink="true">https://forum.iobroker.net/post/388558</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Wed, 04 Mar 2020 16:31:34 GMT</pubDate></item></channel></rss>