# Toggle Button

**URL:** <https://community.symcon.de/t/toggle-button/25636>\
**Category:** Visualisierung\
**Created:** [7. Juli 2011 um 15:02 UTC](https://community.symcon.de/t/toggle-button/25636 "2011-07-07T15:02:46Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![ChristianL](https://community.symcon.de/user_avatar/community.symcon.de/christianl/32/29633_2.png) [@ChristianL](https://community.symcon.de/u/ChristianL)\
**Post date:** [7. Juli 2011 um 21:49 UTC](https://community.symcon.de/t/toggle-button/25636/21 "2011-07-07T21:49:31Z")

</div>

Jup, tatsächlich:

> boolean IPS\_SetVariableProfileAssociation ( integer $ProfilName, float $Wert, string $Name, string  
> $Icon )

Habe hier die „IPS-Bibel“ neben mir liegen…brauche immer was zum blättern…ist dann wohl überholt.  
Nebenbei bemerkt sieht die auch schon aus wie ein Buch aus den 60ern 😛

---

<div class="post-metadata">

**Author:** ![RWN](https://community.symcon.de/user_avatar/community.symcon.de/rwn/32/125_2.png) [@RWN](https://community.symcon.de/u/RWN)\
**Post date:** [7. Juli 2011 um 21:50 UTC](https://community.symcon.de/t/toggle-button/25636/22 "2011-07-07T21:50:56Z")

</div>

Die dürfte noch von V2.2 sein.

Wenn aktuell, die Doku lesen.

---

<div class="post-metadata">

**Author:** ![ChristianL](https://community.symcon.de/user_avatar/community.symcon.de/christianl/32/29633_2.png) [@ChristianL](https://community.symcon.de/u/ChristianL)\
**Post date:** [7. Juli 2011 um 22:30 UTC](https://community.symcon.de/t/toggle-button/25636/23 "2011-07-07T22:30:20Z")

</div>

Ok, guckt mal was ich hier gebaut habe:

```php
<?

if($IPS_SENDER == "WebFront")
{
    switch($IPS_VALUE)
    {
        case 1:
        IPS_SetVariableProfileAssociation("Aus_Aus", 0, "Aus", "", 0xE53300);
        IPS_SetVariableProfileAssociation("Aus_Aus", 1, "", "", 0xE53300);
        SetValueInteger(42217, 0);
        IPS_Sleep(100);
        SetValueInteger(42217, 1);
		  break;
        case 0:
        IPS_SetVariableProfileAssociation("Aus_Aus", 1, "Aus", "", 0xE53300);
        IPS_SetVariableProfileAssociation("Aus_Aus", 0, "", "", 0xE53300);
        SetValueInteger(42217, 0);
        IPS_Sleep(100);
        SetValueInteger(42217, 1);
        break;
    }
}

```

Jetzt gibt es nur noch Aus und ich bekomme ein kurzes Feedback bei Tastendruck.  
Allerdings nur bei jedem 2. mal. Warum ist das so?

---

<div class="post-metadata">

**Author:** ![RWN](https://community.symcon.de/user_avatar/community.symcon.de/rwn/32/125_2.png) [@RWN](https://community.symcon.de/u/RWN)\
**Post date:** [7. Juli 2011 um 22:34 UTC](https://community.symcon.de/t/toggle-button/25636/24 "2011-07-07T22:34:37Z")

</div>

Lass mich raten, 42217 ist deine Integervariable mit Profil. Warum setzt Du diese noch mal. Sie wird doch über SetVariableProfile… gesetzt.

Oder liege ich falsch.

```php
<?

if($IPS_SENDER == "WebFront")
{
   SetValue($IPS_VARIABLE, $IPS_VALUE);
    switch($IPS_VALUE)
    {
        case 0:
        IPS_SetVariableProfileAssociation("Aus_Aus", 0, "Aus", "", 0xE53300);
        break;
    }
}

?>

```

---

<div class="post-metadata">

**Author:** ![ChristianL](https://community.symcon.de/user_avatar/community.symcon.de/christianl/32/29633_2.png) [@ChristianL](https://community.symcon.de/u/ChristianL)\
**Post date:** [7. Juli 2011 um 22:41 UTC](https://community.symcon.de/t/toggle-button/25636/25 "2011-07-07T22:41:50Z")

</div>

Also wenn ich das jetzt mal so durchschaut habe, setze ich mit IPS\_SetVariableProfileAssociation einfach nur die Assoziation für 0 und 1 in meiner Variable (plus Wert & Farbe)

Also wird meine Variable im Ersten schritt mit der Assoziation 0 auf den Wert Aus gesetzt. Die Assoziation 0 wird gelöscht.

Anschliessend setzte ich sie allerdings manuell für eine kurze Zeit (100ms) auf aus und dann wieder ein, das bringt mir eine kurzes visuelles feedback im WF.

Nur eben im zweiten Step haut das nicht hin.

Worauf bezieht sich denn das case0 / case1?

---

<div class="post-metadata">

**Author:** ![RWN](https://community.symcon.de/user_avatar/community.symcon.de/rwn/32/125_2.png) [@RWN](https://community.symcon.de/u/RWN)\
**Post date:** [7. Juli 2011 um 22:57 UTC](https://community.symcon.de/t/toggle-button/25636/26 "2011-07-07T22:57:55Z")

</div>

Wenn Du nur einen z.B. Aus-Befehl senden willst, brauchst Du das ganze Gedönse nicht. Im Profil nur einen Wert anlegen und im Script den Code von dfhome ohne ! vor $IPS\_VALUE.

case bezieht sich auf den Wert der hinterlegt ist. Wenn Du jetzt 2345 hinterlegst muss um zu schalten der case auch 2345 sein. Also case 2345:

---

<div class="post-metadata">

**Author:** ![ChristianL](https://community.symcon.de/user_avatar/community.symcon.de/christianl/32/29633_2.png) [@ChristianL](https://community.symcon.de/u/ChristianL)\
**Post date:** [7. Juli 2011 um 23:18 UTC](https://community.symcon.de/t/toggle-button/25636/27 "2011-07-07T23:18:59Z")

</div>

Hurra, ich kann nun AUS schalten! (wenn auch ohne optisches feedback)

Jetzt reicht es aber auch erst mal für heute, Kopf frei kriegen…

Morgen gehts dann ans eingemachte: Quellen Auswahl in einer Zeile 🙂

Hast du morgen schon was vor, Rainer?? :D;)

---

<div class="post-metadata">

**Author:** ![chrissiboy](https://community.symcon.de/letter_avatar_proxy/v4/letter/c/d2c977/32.png) [@chrissiboy](https://community.symcon.de/u/chrissiboy)\
**Post date:** [13. August 2011 um 11:45 UTC](https://community.symcon.de/t/toggle-button/25636/28 "2011-08-13T11:45:10Z")

</div>

Hallo,

ich habe das jetzt auch mal ausprobiert und es hat soweit funktioniert; aber entweder habe ich etwas falsch gemacht oder man muss dann für jede Variable ein eigenes Profil anlegen, denn wenn man das Profil ändert, schlägt sich das ja auf alle durch. Oder verstehe ich es gerade nicht so recht ?

---

<div class="post-metadata">

**Author:** ![RWN](https://community.symcon.de/user_avatar/community.symcon.de/rwn/32/125_2.png) [@RWN](https://community.symcon.de/u/RWN)\
**Post date:** [13. August 2011 um 11:50 UTC](https://community.symcon.de/t/toggle-button/25636/29 "2011-08-13T11:50:21Z")

</div>

> oder man muss dann für jede Variable ein eigenes Profil anlegen

richtig erkannt. 😉

---

<div class="post-metadata">

**Author:** ![chrissiboy](https://community.symcon.de/letter_avatar_proxy/v4/letter/c/d2c977/32.png) [@chrissiboy](https://community.symcon.de/u/chrissiboy)\
**Post date:** [13. August 2011 um 12:20 UTC](https://community.symcon.de/t/toggle-button/25636/30 "2011-08-13T12:20:13Z")

</div>

hm - das ist nicht wirklich praktisch und entspricht nicht dem Sinn eines Profils - dann sind es ja fixe Attribute, die zur Variablen gehören ☹  
aber gut, ist halt so - danke für die Bestätigung

---

<div class="post-metadata">

**Author:** ![RWN](https://community.symcon.de/user_avatar/community.symcon.de/rwn/32/125_2.png) [@RWN](https://community.symcon.de/u/RWN)\
**Post date:** [13. August 2011 um 12:49 UTC](https://community.symcon.de/t/toggle-button/25636/31 "2011-08-13T12:49:21Z")

</div>

Hier ging es um einen Einzelnen Button für ein spezielles Gerät und nicht um ein Profil für 1000 Button.

---

<div class="post-metadata">

**Author:** ![TBe](https://community.symcon.de/user_avatar/community.symcon.de/tbe/32/123_2.png) [@TBe](https://community.symcon.de/u/TBe)\
**Post date:** [16. Juli 2012 um 16:30 UTC](https://community.symcon.de/t/toggle-button/25636/32 "2012-07-16T16:30:28Z")

</div>

Hallo Rainer,

bin etwas am verzweifeln. Hab das so gemacht wie beschrieben, aber leider wird bei mir der „Schließen“ Status nicht in die Integer Variable geschrieben und ist damit leider auch nur grau ( also blass - grau --\> wie inaktiv )

```php
<?
if($IPS_SENDER == "WebFront")
{
    switch($IPS_VALUE)
    {
        case 1:
        IPS_SetVariableProfileAssociation("Tor1", 0, "öffnen", "", 0x04B404);
        IPS_SetVariableProfileAssociation("Tor1", 1, "", "", -1);
        break;
        case 0:
        IPS_SetVariableProfileAssociation("Tor1", 1, "schließen", "", -1);
        IPS_SetVariableProfileAssociation("Tor1", 0, "", "", -1);
        break;
    }
}

 TMEX_F3A_SetPin(30124 /*[Räume\Garage\Garagentore]*/, 1, true);
 Sleep(1);
 TMEX_F3A_SetPin(30124 /*[Räume\Garage\Garagentore]*/, 1, false);

?>

```

Heißt die Variable hat einmal Inhalt öffnen und einmal leer. Irgendwo mach ich was falsch.

Danke Gruss Thomas

---

<div class="post-metadata">

**Author:** ![RWN](https://community.symcon.de/user_avatar/community.symcon.de/rwn/32/125_2.png) [@RWN](https://community.symcon.de/u/RWN)\
**Post date:** [16. Juli 2012 um 16:32 UTC](https://community.symcon.de/t/toggle-button/25636/33 "2012-07-16T16:32:01Z")

</div>

Du hast bei schließen ja auch keine Farbe eingetragen. Dort steht bei dir -1. 😉

---

<div class="post-metadata">

**Author:** ![TBe](https://community.symcon.de/user_avatar/community.symcon.de/tbe/32/123_2.png) [@TBe](https://community.symcon.de/u/TBe)\
**Post date:** [16. Juli 2012 um 16:48 UTC](https://community.symcon.de/t/toggle-button/25636/34 "2012-07-16T16:48:12Z")

</div>

🙂 … wußte dass die Antwort kommt …

ne passiert auch , wenn ich dort eine Farbe eintrage. Die Farbe wird halt nicht kräftig dargestellt, sondern wir bei den Boolean Variablen der jeweils inaktive Button. Ist jetzt nicht so kriegsentscheidend, aber optisch nicht so schön.

Gruss

---

<div class="post-metadata">

**Author:** ![RWN](https://community.symcon.de/user_avatar/community.symcon.de/rwn/32/125_2.png) [@RWN](https://community.symcon.de/u/RWN)\
**Post date:** [16. Juli 2012 um 16:50 UTC](https://community.symcon.de/t/toggle-button/25636/35 "2012-07-16T16:50:02Z")

</div>

Ok, missverstanden. 😃

Zeig mal von deiner Variablen die Assoziation.

Hier kannst auch direkt aus dem Script testen.

```php
<?

if($IPS_SENDER == "Execute")
{
    $value = IPS_GetVariableProfile("EinAus");
    switch($value['Associations'][0]['Value'])
    {
         case 0:
        Ein();
        break;
        case 1:
        Aus();
        break;
    }
}

if($IPS_SENDER == "WebFront")
{
   switch($IPS_VALUE)
    {
         case 0:
        Ein();
        break;
        case 1:
          Aus();
        break;
    }
}

function Ein()
{
    IPS_SetVariableProfileAssociation("EinAus", 0, "", "", -1);
    IPS_SetVariableProfileAssociation("EinAus", 1, " öffnen ", "", 0xFFA943);
    SetValue(49757 /*[Test\Button]*/, 1);
}

function Aus()
{
   IPS_SetVariableProfileAssociation("EinAus", 1, "", "", -1);
    IPS_SetVariableProfileAssociation("EinAus", 0, " schliessen ", "", 0x555555);
    SetValue(49757 /*[Test\Button]*/, 0);
}

?>

```

---

<div class="post-metadata">

**Author:** ![TBe](https://community.symcon.de/user_avatar/community.symcon.de/tbe/32/123_2.png) [@TBe](https://community.symcon.de/u/TBe)\
**Post date:** [16. Juli 2012 um 17:39 UTC](https://community.symcon.de/t/toggle-button/25636/36 "2012-07-16T17:39:49Z")

</div>

Hallo Rainer,

das wars… hatte das SetValue vergessen. Jetzt funktioniert alles .

Danke !

Gruss Thomas

---

<div class="post-metadata">

**Author:** ![wuppi83](https://community.symcon.de/letter_avatar_proxy/v4/letter/w/838e76/32.png) [@wuppi83](https://community.symcon.de/u/wuppi83)\
**Post date:** [28. Januar 2013 um 18:08 UTC](https://community.symcon.de/t/toggle-button/25636/37 "2013-01-28T18:08:17Z")

</div>

Hallo zusammen,

habe das gerade mal probiert

```php
<?

if($IPS_SENDER == "WebFront")
{
    switch($IPS_VALUE)
    {
        case 1:
        IPS_SetVariableProfileAssociation("Test", 0, "Ein", "An", 0xFFA943);
        IPS_SetVariableProfileAssociation("Test", 1, "", "", -1);
        break;
        case 0:
        IPS_SetVariableProfileAssociation("Test", 1, "Aus", "Aus", -1);
        IPS_SetVariableProfileAssociation("Test", 0, "", "", -1);
        break;
    }
}

?>

```

bei Aus kommt jedoch kein Icon. Hat einer Idee warum ?

Danke

Andreas

---

<div class="post-metadata">

**Author:** ![cooljack](https://community.symcon.de/letter_avatar_proxy/v4/letter/c/a587f6/32.png) [@cooljack](https://community.symcon.de/u/cooljack)\
**Post date:** [5. Januar 2015 um 09:13 UTC](https://community.symcon.de/t/toggle-button/25636/38 "2015-01-05T09:13:14Z")

</div>

> [@wuppi83](#):
>
> Hallo zusammen,
> 
> habe das gerade mal probiert
> 
> ```php
> <?
> 
> if($IPS_SENDER == "WebFront")
> {
> switch($IPS_VALUE)
> {
> case 1:
> IPS_SetVariableProfileAssociation("Test", 0, "Ein", "An", 0xFFA943);
> IPS_SetVariableProfileAssociation("Test", 1, "", "", -1);
> break;
> case 0:
> IPS_SetVariableProfileAssociation("Test", 1, "Aus", "Aus", -1);
> IPS_SetVariableProfileAssociation("Test", 0, "", "", -1);
> break;
> }
> }
> 
> ?>
> 
> ```
> 
> bei Aus kommt jedoch kein Icon. Hat einer Idee warum ?
> 
> Danke
> 
> Andreas

Wie dein vorschreiber auch schon (;

```
SetValue(49757 /*[Test\Button]*/, 0); fehlt 

```

jeweils bei case 0 und 1 mit  
SetValue(49757 /_[Test\Button]_/, 0);  
SetValue(49757 /_[Test\Button]_/, 1); ect…

---

<div class="post-metadata">

**Author:** ![Elektro](https://community.symcon.de/user_avatar/community.symcon.de/elektro/32/594_2.png) [@Elektro](https://community.symcon.de/u/Elektro)\
**Post date:** [21. Dezember 2015 um 13:50 UTC](https://community.symcon.de/t/toggle-button/25636/39 "2015-12-21T13:50:50Z")

</div>

Hallo , kann mir bitte einer helfen ?  
ich habe einen Toggelbutton erstellt der mir für meine Bedürfnisse ein wenig zu schmal ist . Aus und ein funktionieren so wie gewollt.

 ![tog1.PNG](https://community.symcon.de/uploads/default/original/2X/c/c4b76ecd129d2f677d572d6b6263e0fb66fe41b0.png)

 ![tog2.PNG](https://community.symcon.de/uploads/default/original/2X/2/2e98bdc68b8b8bfede55b0efad615df679104884.png)

ich habe es schon mit Phase5 Editor versucht , aber das war ein Schuss im Ofen.  
Was mache ich nicht richtig ?  
mfg michael

Ps: IP-Symcon ver 4.0

 ![tog3.PNG](https://community.symcon.de/uploads/default/original/2X/1/1496baf392ed8fd4f94136674357b57b28fad251.png) ich habe es mit punkten versucht , sieht aber nicht so doll aus 🙂

---

<div class="post-metadata">

**Author:** ![Bayaro](https://community.symcon.de/user_avatar/community.symcon.de/bayaro/32/699_2.png) [@Bayaro](https://community.symcon.de/u/Bayaro)\
**Post date:** [21. Dezember 2015 um 14:08 UTC](https://community.symcon.de/t/toggle-button/25636/40 "2015-12-21T14:08:04Z")

</div>

Funktioniert an der Stelle „ALT + 255“ ?! 🙂 Also ALT gedrückt halten und dann 2, dann 5 und nochmal 5… Sollte ein „unsichtbares“ Zeichen sein 🙂

Grüße,  
Chris

[Vorherige Seite](https://community.symcon.de/t/toggle-button/25636.md?page=1)

[Nächste Seite](https://community.symcon.de/t/toggle-button/25636.md?page=3)
