<?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[Werte in ein Register Schreiben]]></title><description><![CDATA[<p dir="auto">Hallo zusammen,<br />
ich habe folgenden Code. Leider tut sich nichts.<br />
Von einer SPS wird ein Merker gesetzt. Bei True soll 256 in ein Modbus Register geschrieben werden und der Merker selbst wieder zurück gesetzt. Bei Status false soll 512 in das Register geschreiben werden. Hier mein Code.</p>
<pre><code>const Wohnen_L01 = 'modbus.0.holdingRegisters.Ausgang-01'/*Output*/;
const Merker_L01 = 's7.0.Markers.25.Wohnen_L01'/*Merker*/;


// Überwachung des Merkers
on({id: Merker_L01, change: "ne"}, (obj) =&gt; {
    // Holen des aktuellen Status (true/false)
    const status = obj.state.val;

    if (status === true) {
        setState(Wohnen_L01, 256);
        setState(Merker_L01, false);
        console.log("Merker ist TRUE: Schreibe 256");
    } else {
        setState(Wohnen_L01, 512);
        console.log("Merker ist FALSE: Schreibe 512");
    }
});
</code></pre>
]]></description><link>https://forum.iobroker.net/topic/84493/werte-in-ein-register-schreiben</link><generator>RSS for Node</generator><lastBuildDate>Wed, 13 May 2026 08:10:50 GMT</lastBuildDate><atom:link href="https://forum.iobroker.net/topic/84493.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 07 May 2026 12:29:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Sun, 10 May 2026 11:26:31 GMT]]></title><description><![CDATA[<p dir="auto">Oha, das es so einfach ist hätte ich jetzt nicht gedacht. Da habe ich ja diese Woche eine Menge gelernt</p>
]]></description><link>https://forum.iobroker.net/post/1338914</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338914</guid><dc:creator><![CDATA[TOBO]]></dc:creator><pubDate>Sun, 10 May 2026 11:26:31 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Sat, 09 May 2026 21:31:25 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tobo" aria-label="Profile: TOBO">@<bdi>TOBO</bdi></a> [sagte]: Wohnen_L01 bis Wohnen_L24 in einem Rutsch auf 512 schreiben?</p>
</blockquote>
<p dir="auto">Kann man: <a href="https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/javascript.md#---selector" rel="nofollow ugc">Siehe Doku</a></p>
<pre><code>$('modbus.0.holdingRegisters.Ausgang-*').setState(512);
</code></pre>
]]></description><link>https://forum.iobroker.net/post/1338854</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338854</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sat, 09 May 2026 21:31:25 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Sat, 09 May 2026 18:20:41 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> <a href="/post/1338631">sagte</a>:</p>
<p dir="auto">const ids = $('s7.0.Markers.*').toArray();<br />
// Überwachung aller Merker<br />
on({id: ids}, (dp) =&gt; { // triggert auf jede Aktualisierung<br />
log(<a href="http://dp.id" rel="nofollow ugc">dp.id</a> + ': ' + dp.state.val);<br />
});</p>
</blockquote>
<p dir="auto">Du hast damit eine sehr interessante Frage bei mir generiert. Ich habe 24 Relais welche über die Merker geschaltet werden. Kann man über den obigen Ansatz von Dir auch 24 DP gleichzeitig schreiben?</p>
<pre><code>setState(Wohnen_L01, 512);

</code></pre>
<p dir="auto">Wohnen_L01 bis Wohnen_L24 in einem Rutsch auf 512 schreiben? Bzw. heissen die Datenpunkte so wie im Bild.<br />
<img src="/assets/uploads/files/1778350777834-modbus.jpg" alt="Modbus.JPG" class=" img-fluid img-markdown" /></p>
<p dir="auto">Modbus.0.hodingRegisters.Ausgang-01 bis Ausgang 24</p>
]]></description><link>https://forum.iobroker.net/post/1338840</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338840</guid><dc:creator><![CDATA[TOBO]]></dc:creator><pubDate>Sat, 09 May 2026 18:20:41 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Sat, 09 May 2026 12:18:29 GMT]]></title><description><![CDATA[<p dir="auto">Danke, das erklärt einiges für mich.</p>
]]></description><link>https://forum.iobroker.net/post/1338802</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338802</guid><dc:creator><![CDATA[TOBO]]></dc:creator><pubDate>Sat, 09 May 2026 12:18:29 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Sat, 09 May 2026 12:15:38 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tobo" aria-label="Profile: TOBO">@<bdi>TOBO</bdi></a> [sagte]: muss man aus dem DP, was ein Objekt ist immer erst den Status ermitteln ?</p>
</blockquote>
<p dir="auto">Ja, der <strong>Wert</strong> des DP soll geprüft werden.</p>
]]></description><link>https://forum.iobroker.net/post/1338801</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338801</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sat, 09 May 2026 12:15:38 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Sat, 09 May 2026 12:12:27 GMT]]></title><description><![CDATA[<p dir="auto">Also muss man aus dem DP, was ein Objekt ist immer erst den Status ermitteln ?</p>
]]></description><link>https://forum.iobroker.net/post/1338800</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338800</guid><dc:creator><![CDATA[TOBO]]></dc:creator><pubDate>Sat, 09 May 2026 12:12:27 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Sat, 09 May 2026 12:13:15 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tobo" aria-label="Profile: TOBO">@<bdi>TOBO</bdi></a> [sagte]: gibt es keine andere Möglichkeit den DP<br />
direkt in der IF Abfrage auszuwerten ?</p>
</blockquote>
<p dir="auto">Zwei Möglichkeiten, wobei die zweite mehr Ressourcen verbraucht.</p>
<pre><code>if(obj.state.val) 
if(getState(Merker_L01).val)
</code></pre>
<p dir="auto">Bessere Version, die mit nur einem <em>setState()</em> noch weniger Ressourcen verbraucht:</p>
<pre><code>on(Merker_L01, (dp) =&gt; { // triggert auf Wertänderung
    setState(Wohnen_L01, dp.state.val ? 256 : 512);
});
</code></pre>
]]></description><link>https://forum.iobroker.net/post/1338799</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338799</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sat, 09 May 2026 12:13:15 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Sat, 09 May 2026 12:06:17 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> <a href="/post/1338797">sagte</a>:</p>
<p dir="auto">Merker_L01 enthält einen konstanten String (die ID), kann also nicht true werden.</p>
</blockquote>
<p dir="auto">Der DP ist doch als Bolean deklariert. gibt es keine andere Möglichkeit den DP<br />
direkt in der IF Abfrage auszuwerten ?</p>
]]></description><link>https://forum.iobroker.net/post/1338798</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338798</guid><dc:creator><![CDATA[TOBO]]></dc:creator><pubDate>Sat, 09 May 2026 12:06:17 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Sat, 09 May 2026 12:01:47 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tobo" aria-label="Profile: TOBO">@<bdi>TOBO</bdi></a> [sagte]: verstehen warum?</p>
</blockquote>
<p dir="auto"><em>Merker_L01</em> enthält einen konstanten String (die ID), kann also nicht <em>true</em> werden.</p>
]]></description><link>https://forum.iobroker.net/post/1338797</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338797</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sat, 09 May 2026 12:01:47 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Sat, 09 May 2026 11:57:06 GMT]]></title><description><![CDATA[<p dir="auto">Ich möchte nicht extra noch einen Thread aufmachen für eine kurze Frage.<br />
Warum funktioniert dies hier:</p>
<pre><code>const Wohnen_L01 = 'modbus.0.holdingRegisters.Ausgang-01'/*Output*/;
const Merker_L01 = 's7.0.Markers.25.Wohnen_L01'/*Merker*/;

on({id: Merker_L01, change: "ne"}, (obj) =&gt; {
   
    const status = obj.state.val;
 
    if (status === true) {
        setState(Wohnen_L01, 256);
     } else {
        setState(Wohnen_L01, 512);
      }
});
</code></pre>
<p dir="auto">und dies hier funktioniert nicht</p>
<pre><code>const Wohnen_L01 = 'modbus.0.holdingRegisters.Ausgang-01'/*Output*/;
const Merker_L01 = 's7.0.Markers.25.Wohnen_L01'/*Merker*/;

on({id: Merker_L01, change: "ne"}, (obj) =&gt; {
   
    if (Merker_L01 === true) {
        setState(Wohnen_L01, 256);
     } else {
        setState(Wohnen_L01, 512);
      }
});
</code></pre>
<p dir="auto">beim zweiten habe ich hinter dem if direkt den DP geschrieben und nicht die Variable Status. Der zweite Code funktioniert nicht. Ich möchte gern verstehen warum?</p>
]]></description><link>https://forum.iobroker.net/post/1338795</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338795</guid><dc:creator><![CDATA[TOBO]]></dc:creator><pubDate>Sat, 09 May 2026 11:57:06 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 13:04:11 GMT]]></title><description><![CDATA[<p dir="auto">Danke für die Hilfe. Ich hatte ja vermutet das es an etwas grundsätzlichem liegt, weil es absolut keine Reaktion gab. Für die Zukunft wieder was gelernt.</p>
<p dir="auto">Das Blockly war das erste Mal für mich und ich habe das rein intuitiv zusammen gebastelt.</p>
]]></description><link>https://forum.iobroker.net/post/1338691</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338691</guid><dc:creator><![CDATA[TOBO]]></dc:creator><pubDate>Fri, 08 May 2026 13:04:11 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 12:53:30 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tobo" aria-label="Profile: TOBO">@<bdi>TOBO</bdi></a> [sagte]: Jetzt funktioniert es.</p>
</blockquote>
<p dir="auto">Dann wird es auch mit dem S7-Merker funktionieren:</p>
<p dir="auto"><img src="/assets/uploads/files/1778244801895-blockly_temp.jpg" alt="Blockly_temp.JPG" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.iobroker.net/post/1338690</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338690</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Fri, 08 May 2026 12:53:30 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 12:53:27 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tobo" aria-label="Profile: TOBO">@<bdi>TOBO</bdi></a> <a href="/post/1338687">sagte</a>:</p>
<p dir="auto">Jetzt funktioniert es.</p>
</blockquote>
<p dir="auto">Achwas 😉</p>
<p dir="auto">Schön!<br />
Und jetzt mit</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tobo" aria-label="Profile: TOBO">@<bdi>TOBO</bdi></a> <a href="/post/1338672">sagte</a>:</p>
<p dir="auto">vergiss den S7 DP.</p>
</blockquote>
<p dir="auto">Und dabei<br />
<img src="/assets/uploads/files/1778244784893-751.jpg" alt="751.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">S8nst wird das nur bei Scriptstart ausgeführt</p>
]]></description><link>https://forum.iobroker.net/post/1338688</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338688</guid><dc:creator><![CDATA[Homoran]]></dc:creator><pubDate>Fri, 08 May 2026 12:53:27 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 12:47:48 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> <a href="/post/1338685">sagte</a>:</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/homoran" aria-label="Profile: Homoran">@<bdi>Homoran</bdi></a> [sagte]: Script nicht unter global!</p>
</blockquote>
<p dir="auto">Jetzt funktioniert es.</p>
]]></description><link>https://forum.iobroker.net/post/1338687</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338687</guid><dc:creator><![CDATA[TOBO]]></dc:creator><pubDate>Fri, 08 May 2026 12:47:48 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 12:45:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tobo" aria-label="Profile: tobo">@<bdi>tobo</bdi></a><br />
...und dann ist es kein Wunder dass der Neustart ewig dauert</p>
]]></description><link>https://forum.iobroker.net/post/1338686</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338686</guid><dc:creator><![CDATA[Homoran]]></dc:creator><pubDate>Fri, 08 May 2026 12:45:11 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 12:56:51 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/homoran" aria-label="Profile: Homoran">@<bdi>Homoran</bdi></a> [sagte]: Script nicht unter global!</p>
</blockquote>
<p dir="auto">Unter "global" dürfen nur Skripte liegen, die häufig verwendete <strong>eigene Funktionen</strong> enthalten, denn sie werden in <strong>jedes</strong> andere Skript kopiert und dort bei Aufruf ausgeführt.</p>
]]></description><link>https://forum.iobroker.net/post/1338685</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338685</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Fri, 08 May 2026 12:56:51 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 12:35:56 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tobo" aria-label="Profile: TOBO">@<bdi>TOBO</bdi></a> [sagte]: Ist aktiviert.</p>
</blockquote>
<p dir="auto">Dann wird "steuere" nicht ausgeführt!!</p>
]]></description><link>https://forum.iobroker.net/post/1338683</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338683</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Fri, 08 May 2026 12:35:56 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 12:38:16 GMT]]></title><description><![CDATA[<p dir="auto">Debug ausschalten!<br />
Script nicht unter global!</p>
<p dir="auto"><img src="/assets/uploads/files/1778243890658-755.jpg" alt="755.jpg" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.iobroker.net/post/1338682</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338682</guid><dc:creator><![CDATA[Homoran]]></dc:creator><pubDate>Fri, 08 May 2026 12:38:16 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 12:35:31 GMT]]></title><description><![CDATA[<p dir="auto">zum Beispiel dauert es ewig bis "Instanz ist deaktiviert" verschwindet.</p>
<p dir="auto"><img src="/assets/uploads/files/1778243677590-script.png" alt="script.PNG" class=" img-fluid img-markdown" /></p>
<p dir="auto">Das ändert sich auch nicht mehr.</p>
]]></description><link>https://forum.iobroker.net/post/1338680</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338680</guid><dc:creator><![CDATA[TOBO]]></dc:creator><pubDate>Fri, 08 May 2026 12:35:31 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 12:33:22 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tobo" aria-label="Profile: TOBO">@<bdi>TOBO</bdi></a> <a href="/post/1338678">sagte</a>:</p>
<p dir="auto">Ist aktiviert</p>
</blockquote>
<p dir="auto">Darf nicht!<br />
Dann läuft nichts</p>
]]></description><link>https://forum.iobroker.net/post/1338679</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338679</guid><dc:creator><![CDATA[Homoran]]></dc:creator><pubDate>Fri, 08 May 2026 12:33:22 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 12:32:40 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> <a href="/post/1338675">sagte</a>:</p>
<p dir="auto">Es ist nicht der Debug-Modus (Skript-Editor ganz rechts oben) aktiviert?</p>
</blockquote>
<p dir="auto">Ist aktiviert. Ich habe es mit Log Einträgen versucht oder mit console.log aber es kommt absolut nichts.</p>
]]></description><link>https://forum.iobroker.net/post/1338678</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338678</guid><dc:creator><![CDATA[TOBO]]></dc:creator><pubDate>Fri, 08 May 2026 12:32:40 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 12:32:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tobo" aria-label="Profile: TOBO">@<bdi>TOBO</bdi></a> ok, der ist bool - gut!</p>
<p dir="auto">Da eigener DP, bitte bestätigt schreiben</p>
<p dir="auto">Aber wie <a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> schon schrieb, hätte (nur) bei Skriptstart die 256 geschrieben werden müssen.</p>
<p dir="auto">Starte das Skript mal neu und zeige den output in dem log-Fenster unter dem Blockly</p>
]]></description><link>https://forum.iobroker.net/post/1338677</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338677</guid><dc:creator><![CDATA[Homoran]]></dc:creator><pubDate>Fri, 08 May 2026 12:32:46 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 12:29:33 GMT]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1778243316763-steuern.png" alt="steuern.PNG" class=" img-fluid img-markdown" /></p>
<p dir="auto">Ich steuer den per Hand um grundsätzlich zu sehen ob JS überhaupt etwas mach und das tut es wohl nicht.</p>
]]></description><link>https://forum.iobroker.net/post/1338676</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338676</guid><dc:creator><![CDATA[TOBO]]></dc:creator><pubDate>Fri, 08 May 2026 12:29:33 GMT</pubDate></item><item><title><![CDATA[Reply to Werte in ein Register Schreiben on Fri, 08 May 2026 12:30:40 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tobo" aria-label="Profile: TOBO">@<bdi>TOBO</bdi></a> [sagte]: es passiert absolut nichts.</p>
</blockquote>
<p dir="auto">Bei Skriptstart hätte eine rote 256 in den DP "StatusTest" geschrieben werden müssen.<br />
Es ist nicht der Debug-Modus (Skript-Editor ganz rechts oben) aktiviert?</p>
]]></description><link>https://forum.iobroker.net/post/1338675</link><guid isPermaLink="true">https://forum.iobroker.net/post/1338675</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Fri, 08 May 2026 12:30:40 GMT</pubDate></item></channel></rss>