FHEM Forum

FHEM => English Corner => Thema gestartet von: kroonen am 31 Januar 2023, 21:38:07

Titel: 2 devices (Power 1 and Power 2) as 2 toggle icons
Beitrag von: kroonen am 31 Januar 2023, 21:38:07
Hi,

I have a device with 2 sockets. With one socket , I can create a device with only and icon to toggle it. Is this also possible with 2 sockets in one entry

I have this, but I can't click the icons


   IODev      mqtt2
   autocreate 0
   comment    no
   devStateIcon 1.ON:message_socket@orange 1.OFF:message_socket 2.ON:message_socket@orange 2.OFF:message_socket
   icon       outside_socket
   model      tasmota_2ch_unified
   readingList tele/b\Buitenwcd/LWT:.* LWT
  tele/Buitenwcd/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }
  stat/Buitenwcd/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }
  stat/Buitenwcd/POWER1:.* POWER1
  stat/Buitenwcd/POWER2:.* POWER2
   room       Buiten
   setList    1:noArg cmnd/Buitenwcd/POWER1 2
2:noArg cmnd/Buitenwcd/POWER2 2

   setStateList 1 2
   stateFormat 1:POWER1
2:POWER2
   webCmd     :

Titel: Antw:2 devices (Power 1 and Power 2) as 2 toggle icons
Beitrag von: Beta-User am 01 Februar 2023, 09:29:53
Hi, seems you used a rather old version of the "unified"attrTemplate. The newer one assigns especially attr DEVICE devStateIcon Online:10px-kreis-gruen Offline:10px-kreis-rot 1.on:on:POWER1+off 1.off:off:POWER1+on 2.on:on:POWER2+off 2.off:off:POWER2+on
Pls. note the third argument, so if you want to keep the coloured message_socket-icons, you will just have to adopt that part.
Titel: Antw:2 devices (Power 1 and Power 2) as 2 toggle icons
Beitrag von: kroonen am 02 Februar 2023, 22:43:17
Thnx. I had to modify a bit, but I got it working