<?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[Zwei Variablen verknüpfen]]></title><description><![CDATA[<p dir="auto">Hi.</p>
<p dir="auto">Aktuell nutze ich den Code</p>
<pre><code>on(Variable1, Variable2);
</code></pre>
<p dir="auto">um bei Änderung von Variable1 den Wert in Variable2 zu schreiben.</p>
<p dir="auto">Geht das dann auch automatisch in die andere Richtung oder muss ich da extra Code schreiben?</p>
<p dir="auto">Hintergrund ist eine schaltbare Steckdose.</p>
<p dir="auto">Schalte ich in der Software (Loxone = Variable1) die Steckdose (Variable2) geht der Code.</p>
<p dir="auto">Wenn ich aber die Taste an der Steckdose drücke soll auch in Loxone diese Info ankommen.</p>
<p dir="auto">Danke für die Info,</p>
<p dir="auto">Andreas</p>
]]></description><link>https://forum.iobroker.net/topic/10532/zwei-variablen-verknüpfen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 23:34:41 GMT</lastBuildDate><atom:link href="https://forum.iobroker.net/topic/10532.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 02 Feb 2018 12:18:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zwei Variablen verknüpfen on Sat, 10 Feb 2018 18:42:59 GMT]]></title><description><![CDATA[<p dir="auto"><s><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a>:</s></p>
<blockquote>
<p dir="auto">.. (habe es gerade getestet).. `  Danke, gut zu wissen.. War mir nämlich auch nicht 100% sicher. :lol:</p>
</blockquote>
<p dir="auto">Gruß</p>
]]></description><link>https://forum.iobroker.net/post/130818</link><guid isPermaLink="true">https://forum.iobroker.net/post/130818</guid><dc:creator><![CDATA[BuZZy]]></dc:creator><pubDate>Sat, 10 Feb 2018 18:42:59 GMT</pubDate></item><item><title><![CDATA[Reply to Zwei Variablen verknüpfen on Sat, 10 Feb 2018 18:51:11 GMT]]></title><description><![CDATA[<p dir="auto"><s><a class="plugin-mentions-user plugin-mentions-a" href="/user/buzzy" aria-label="Profile: BuZZy">@<bdi>BuZZy</bdi></a>:</s></p>
<blockquote>
<p dir="auto">Du musst noch prüfen ob Variable1 bereits Variable2 ist und umgekehrt bzw. ob der Wert ein neuer ist.. `<br />
Das ist nicht erforderlich, da nur bei Wertänderung ausgelöst wird (habe es gerade getestet). Allerdings wird einmal zuviel gesendet. Das würde ich verhindern.</p>
</blockquote>
<pre><code>const id1 = '...'; // Stecker
const id2 = '...'; // Loxone

var val = getState(id1).val;
setState(id2, val);

on(id1, function(dp) {
   if(dp.state.val != val) {
      val = dp.state.val;
      setState(id2, val);
   }
});
on(id2, function(dp) {
   if(dp.state.val != val) {
      val = dp.state.val;
      setState(id1, val);
   }
});

</code></pre>
]]></description><link>https://forum.iobroker.net/post/130810</link><guid isPermaLink="true">https://forum.iobroker.net/post/130810</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sat, 10 Feb 2018 18:51:11 GMT</pubDate></item><item><title><![CDATA[Reply to Zwei Variablen verknüpfen on Sat, 10 Feb 2018 14:51:20 GMT]]></title><description><![CDATA[<p dir="auto">Nein, geht nicht automatisch..</p>
<p dir="auto">Du musst den Code nochmal einfügen und Variable1 und 2 tauschen..</p>
<p dir="auto">Die Logik ist</p>
<p dir="auto">"Wenn Variable1 geändert wird, schreibe den Wert von Variable1 in Variable2"..</p>
<p dir="auto">Aber du würdest dir damit eine Schleife bauen.</p>
<p dir="auto">Du musst noch prüfen ob Variable1 bereits Variable2 ist und umgekehrt bzw. ob der Wert ein neuer ist..</p>
<pre><code>on('stateId1', 'stateId2', change: "ne");
````Ansonsten schreibst du ja die ganze Zeit hin und her.. :D

Gruß</code></pre>
]]></description><link>https://forum.iobroker.net/post/130774</link><guid isPermaLink="true">https://forum.iobroker.net/post/130774</guid><dc:creator><![CDATA[BuZZy]]></dc:creator><pubDate>Sat, 10 Feb 2018 14:51:20 GMT</pubDate></item></channel></rss>