[gelöst] webLink als Lösung für zweites Icon für ein Device --> Statusanzeige

Begonnen von Spook112, 02 September 2020, 13:58:12

Vorheriges Thema - Nächstes Thema

Spook112

Hi, nach langem suchen und versuchen ist der Groschen bei mir immer noch nicht gefallen - und deshalb dieser Call for Help

Was will ich erreichen?
Ich möchte für ein und dasselbe Device (Lampe) im Floorplan zwei Icons anzeigen, die natürlich auch beide immer den aktuellen Status anzeigen sollen.
Ein Icon ist natürlich kein Problem und Status wechselt mittels der Verwendung  devStateIcon wunderbar - alles gut.

Nun gibt es in der Realität 2 Lampen, die gemeinsam über denselben Schalter geschaltet werden und ich möchte im Floorplan auch an beiden Stellen jeweils ein Icon darstellen - und beide sollen je nach Status on/off auch den jeweiligen Status anzeigen.

Für die zweite Postion habe ich also einen WebLink angelegt und dessen Icon an der passenden Stelle positioniert.
Es ist dasselbe Icon wie die "Quelle" auch und auch die Größe und die Farbe des svg Icons habe ich anpassen können - grau hier.

Ich kriege es aber nicht hin, dass das WebLink Icon statusabhängig wie das "eigentliche" Device-Icon umschaltet.

Hat jemand Ideen wie ich das machen kann.

Hier das Listing des WebLinks ...

Internals:
   DEF        htmlCode <svg class=" light_wall_3 grey" data-txt="off" version="1.0" xmlns="http://www.w3.org/2000/svg" width="468pt" height="470pt" viewBox="0 0 468 470" preserveAspectRatio="xMidYMid meet"> <metadata> Created by potrace 1.8, written by Peter Selinger 2001-2007 </metadata> <g transform="translate(0,470) scale(0.15,-0.15)" fill="grey" stroke="none"> <path d="M2801 2957 c-52 -30 -50 -2 -51 -887 l0 -825 -36 -1 c-56 -1 -64 -20 -64 -146 l0 -108 -260 0 -260 0 0 24 c0 22 5 23 75 29 129 10 230 71 279 169 l26 52 0 435 0 436 -24 50 c-33 72 -103 131 -187 156 -62 19 -89 20 -301 17 -227 -3 -234 -4 -289 -29 -68 -32 -124 -87 -153 -148 -20 -45 -21 -59 -21 -476 0 -499 -1 -490 90 -574 63 -57 121 -80 223 -88 68 -6 72 -7 72 -30 0 -16 -8 -27 -25 -33 -59 -22 -71 -128 -18 -170 25 -19 38 -20 399 -20 l374 0 0 -120 c0 -109 2 -122 21 -141 15 -15 30 -20 50 -17 l29 5 0 -223 0 -222 25 -30 c34 -40 75 -49 123 -25 26 13 41 28 49 53 15 46 18 2765 3 2821 -6 20 -19 44 -29 53 -26 23 -90 30 -120 13z m-488 -770 c69 -53 68 -41 65 -496 -3 -398 -4 -410 -24 -438 -11 -15 -38 -38 -60 -50 -37 -22 -50 -23 -267 -23 -254 0 -272 3 -325 64 l-32 37 0 417 c0 469 -3 450 77 499 37 23 42 23 284 21 l246 -3 36 -28z"></path> <path d="M142 2934 c-53 -26 -83 -58 -118 -124 -18 -32 -19 -63 -19 -420 l0 -385 30 -54 c32 -57 92 -109 138 -118 33 -7 34 -15 4 -28 -25 -11 -35 -56 -15 -72 12 -10 351 -73 390 -73 45 0 66 74 26 89 -13 4 -102 21 -198 37 l-175 29 180 5 c149 4 186 8 218 24 49 24 114 99 127 145 6 21 10 190 10 411 0 427 0 423 -83 496 -64 57 -98 64 -294 64 -162 0 -171 -1 -221 -26z m430 -142 l33 -32 0 -370 0 -370 -33 -32 -32 -33 -143 -3 c-167 -4 -209 5 -237 51 -19 30 -20 53 -20 385 0 301 2 357 16 383 26 51 60 59 231 56 l153 -2 32 -33z"></path> <path d="M171 1671 c-24 -24 -27 -44 -7 -64 8 -8 94 -27 205 -45 212 -36 231 -34 231 19 0 39 -10 42 -200 74 -85 14 -167 28 -182 31 -19 4 -33 -1 -47 -15z"></path> <path d="M165 1536 c-27 -40 -7 -62 67 -75 275 -48 329 -55 346 -45 18 12 29 61 15 75 -9 8 -349 69 -389 69 -14 0 -30 -10 -39 -24z"></path> <path d="M246 1414 c-18 -17 -21 -59 -7 -69 6 -3 61 -15 123 -26 131 -23 158 -18 158 30 0 16 -5 33 -12 37 -12 7 -201 44 -230 44 -9 0 -24 -7 -32 -16z"></path> </g> </svg>

   FUUID      5f3a8314-f33f-5fc3-a36e-8617a18523cf4747
   LINK       <svg class=" light_wall_3 grey" data-txt="off" version="1.0" xmlns="http://www.w3.org/2000/svg" width="468pt" height="470pt" viewBox="0 0 468 470" preserveAspectRatio="xMidYMid meet"> <metadata> Created by potrace 1.8, written by Peter Selinger 2001-2007 </metadata> <g transform="translate(0,470) scale(0.15,-0.15)" fill="grey" stroke="none"> <path d="M2801 2957 c-52 -30 -50 -2 -51 -887 l0 -825 -36 -1 c-56 -1 -64 -20 -64 -146 l0 -108 -260 0 -260 0 0 24 c0 22 5 23 75 29 129 10 230 71 279 169 l26 52 0 435 0 436 -24 50 c-33 72 -103 131 -187 156 -62 19 -89 20 -301 17 -227 -3 -234 -4 -289 -29 -68 -32 -124 -87 -153 -148 -20 -45 -21 -59 -21 -476 0 -499 -1 -490 90 -574 63 -57 121 -80 223 -88 68 -6 72 -7 72 -30 0 -16 -8 -27 -25 -33 -59 -22 -71 -128 -18 -170 25 -19 38 -20 399 -20 l374 0 0 -120 c0 -109 2 -122 21 -141 15 -15 30 -20 50 -17 l29 5 0 -223 0 -222 25 -30 c34 -40 75 -49 123 -25 26 13 41 28 49 53 15 46 18 2765 3 2821 -6 20 -19 44 -29 53 -26 23 -90 30 -120 13z m-488 -770 c69 -53 68 -41 65 -496 -3 -398 -4 -410 -24 -438 -11 -15 -38 -38 -60 -50 -37 -22 -50 -23 -267 -23 -254 0 -272 3 -325 64 l-32 37 0 417 c0 469 -3 450 77 499 37 23 42 23 284 21 l246 -3 36 -28z"></path> <path d="M142 2934 c-53 -26 -83 -58 -118 -124 -18 -32 -19 -63 -19 -420 l0 -385 30 -54 c32 -57 92 -109 138 -118 33 -7 34 -15 4 -28 -25 -11 -35 -56 -15 -72 12 -10 351 -73 390 -73 45 0 66 74 26 89 -13 4 -102 21 -198 37 l-175 29 180 5 c149 4 186 8 218 24 49 24 114 99 127 145 6 21 10 190 10 411 0 427 0 423 -83 496 -64 57 -98 64 -294 64 -162 0 -171 -1 -221 -26z m430 -142 l33 -32 0 -370 0 -370 -33 -32 -32 -33 -143 -3 c-167 -4 -209 5 -237 51 -19 30 -20 53 -20 385 0 301 2 357 16 383 26 51 60 59 231 56 l153 -2 32 -33z"></path> <path d="M171 1671 c-24 -24 -27 -44 -7 -64 8 -8 94 -27 205 -45 212 -36 231 -34 231 19 0 39 -10 42 -200 74 -85 14 -167 28 -182 31 -19 4 -33 -1 -47 -15z"></path> <path d="M165 1536 c-27 -40 -7 -62 67 -75 275 -48 329 -55 346 -45 18 12 29 61 15 75 -9 8 -349 69 -389 69 -14 0 -30 -10 -39 -24z"></path> <path d="M246 1414 c-18 -17 -21 -59 -7 -69 6 -3 61 -15 123 -26 131 -23 158 -18 158 30 0 16 -5 33 -12 37 -12 7 -201 44 -230 44 -9 0 -24 -7 -32 -16z"></path> </g> </svg>

   NAME       attrappe
   NR         253
   STATE      initialized
   TYPE       weblink
   WLTYPE     htmlCode
Attributes:
   fp_First_Floor 86,224,0,
   fp_Groundfloor 86,221,0,
   htmlattr   width="32" height="32"
   icon       light_wall_3
Raspberry PI / RaZberry ZWAVE Modul / RFXTRX433E / 13 Fibaro FGS-222-EN-A-v1.00 / 17 VISION ZD2102-5 / 10 Somfy RTS / 4 Greenwave GWRENS310-F / Gardena Sileno City / 3 Gardena Gartensteckdosen / 2 devolo Home Control Funkschalter / 8 FIBARO System FGSD002 Smoke Sensoren

amenomade

Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Spook112

Vielen Dank @amenomade für diesen Tip.
Funktioniert genau so wie ich es mir gewünscht hatte.

Ich habe also ein readingsProxy Device angelegt (siehe unten) und auf dem Floorplan dort positioniert wo die zweite Lampe ist.
Mittels devStateIcon das entsprechende Icon für die beiden Schaltzustände vorgegeben und fertig ist der Lack.

define readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne readingsProxy GaVo_ZWave_SWITCH_Wandlampen_vorne:state
setuuid readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne 5f50a0e3-f33f-5fc3-ab19-9ae30d09c9d9edf7
attr readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne devStateIcon on:light_wall_3@orange off:light_wall_3@grey
attr readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne fp_First_Floor 84,219,0
attr readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne fp_Groundfloor 84,216,0
attr readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne group Gartenlampen
attr readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne icon light_wall_3
attr readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne room Garten


Zu beachten ist, dass das jetzt ein reines "Anzeige-Icon" ist, also den jeweiligen Status des "Quell-Devices" darstellt, aber über dieses Icon nicht geschaltet werden kann.

Und wie das so ist - Appetit kommt beim Essen.

Hat jemand eine Idee, wie ich es erreichen könnte, dass ich dieses Icon nun auch noch zum Schalten (des "Quell-Devices) nutzen könnte ?  :-)
Raspberry PI / RaZberry ZWAVE Modul / RFXTRX433E / 13 Fibaro FGS-222-EN-A-v1.00 / 17 VISION ZD2102-5 / 10 Somfy RTS / 4 Greenwave GWRENS310-F / Gardena Sileno City / 3 Gardena Gartensteckdosen / 2 devolo Home Control Funkschalter / 8 FIBARO System FGSD002 Smoke Sensoren

det.

wenn Du im FHEM Wiki nach readingsProxy suchst, findest Du dazu genügend Beispiele

LG
det.

Spook112

Danke für den Hinweis - gewusst wo löst so manches Problem ...  :-)

Das Attribut setList hat mich  hier zum Erfolg geführt.

Somit sieht die Konfiguration des readingsProxy jetzt so aus.
(siehe speziell die letzte Zeile)

define readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne readingsProxy GaVo_ZWave_SWITCH_Wandlampen_vorne:state
setuuid readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne 5f50a0e3-f33f-5fc3-ab19-9ae30d09c9d9edf7
attr readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne devStateIcon on:light_wall_3@orange off:light_wall_3@grey
attr readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne fp_First_Floor 84,219,0
attr readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne fp_Groundfloor 84,216,0
attr readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne group Gartenlampen
attr readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne icon light_wall_3
attr readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne room Garten
attr readProx_GaVo_ZWave_SWITCH_Wandlampen_vorne setList on off


Damit habe ich jetzt für 2 Lampen, die über einen Schalter geschaltet werden, in meinem Floorplan 2 Icons an verschiedenen Positionen, die beide den selben Schaltstatus des Schalters (on/off) anzeigen und wo ich den Schalter auch über Anklicken beider Icons an- und ausschalten kann.
Also auch Schalten über den readingsProxy ist damit möglich.
Raspberry PI / RaZberry ZWAVE Modul / RFXTRX433E / 13 Fibaro FGS-222-EN-A-v1.00 / 17 VISION ZD2102-5 / 10 Somfy RTS / 4 Greenwave GWRENS310-F / Gardena Sileno City / 3 Gardena Gartensteckdosen / 2 devolo Home Control Funkschalter / 8 FIBARO System FGSD002 Smoke Sensoren