Problem mit IF und eckigen Klammern im Ausführungsteil

Begonnen von OliS., 10 Oktober 2026, 11:22:33

Vorheriges Thema - Nächstes Thema

OliS.

Da meine Lametric Time nach einem Update offenbar keine lokalen Push Notifications mehr unterstützt, muss ich mein DOIF, welches für verschiedene Statusmeldungen auf der Lametric zuständig ist, auf MQTT publish umstellen.

Da der Payload, der an die Lametric gesendet werden muss, auch eckige Klammern enthält, funktioniert das DOIF mit IF nicht und moniert eine angeblich fehlende rechte Klammer.

Internals:
   CFGFN     
   DEF        ([lametric_icon_sum] > [lmicon_duration])

(IF ([lmi_light] ne "0") (set MQTT2_Broker publish lametric/lametric_wz
{"frames":[
{"icon":"2448","text":"[MQTT2_wz_thermostat:temperature]°C"}
]}))

(IF ([lmi_post] ne "0") (set MQTT2_Broker publish lametric/lametric_wz
{"frames":[
{"icon":"23001","text":"[MQTT2_wz_thermostat:temperature]°C"}
]}))

DOELSEIF

([lametric_icon_sum] == [lmicon_duration])

(IF ([lmi_light] ne "0") (set MQTT2_Broker publish lametric/lametric_wz
{"frames":[
{"icon":"2448","text":"[MQTT2_wz_thermostat:temperature]°C"}
]}))

(IF ([lmi_post] ne "0") (set MQTT2_Broker publish lametric/lametric_wz
{"frames":[
{"icon":"23001","text":"[MQTT2_wz_thermostat:temperature]°C"}
]}))

DOELSEIF

([lametric_icon_sum] == 0)

(set MQTT2_Broker publish lametric/lametric_wz
{"frames":[
{"icon":"","text":"[MQTT2_wz_thermostat:temperature]°C"}]})

DOELSEIF

(["MQTT2_wz_thermostat:temperature"] and [lametric_icon_sum] == 0)

(set MQTT2_Broker publish lametric/lametric_wz
{"frames":[
{"icon":"","text":"[MQTT2_wz_thermostat:temperature]°C"}]})
   FUUID      6ac9e625-f33f-08ae-2e29-03343cd8a81fba3a
   MODEL      FHEM
   NAME       lametric_wz_icon_doif_neu
   NOTIFYDEV  .*(MQTT2_wz_thermostat).*,lametric_icon_sum,lmicon_duration,global
   NR         88400
   NTFY_ORDER 50-lametric_wz_icon_doif_neu
   STATE      cmd_2
   TYPE       DOIF
   VERSION    31153 2026-04-27 14:40:49
   eventCount 51
   READINGS:
     2026-10-10 11:19:54   Device          MQTT2_wz_thermostat
     2026-10-10 11:17:42   cmd             2.2
     2026-10-10 11:17:42   cmd_event       lametric_wz_icon_doif_neu
     2026-10-10 11:17:42   cmd_nr          2
     2026-10-10 11:17:42   cmd_seqnr       2
     2026-10-10 11:17:42   error           IF ([lmi_post] ne "0") (set MQTT2_Broker publish lametric/lametric_wz  {"frames":[  {"icon":"23001","text":"[MQTT2_wz_thermostat:temperature]°C"}  ]}): IF: no right bracket: [  {"icon":"23001"
     2026-10-10 11:17:40   mode            enabled
     2026-10-10 11:17:42   state           cmd_2
   Regex:
     accu:
     bar:
     barAvg:
     collect:
     cond:
       :
         0:
         1:
         2:
         3:
           "MQTT2_wz_thermostat:temperature" MQTT2_wz_thermostat:temperature
       lametric_icon_sum:
         0:
           &STATE     ^lametric_icon_sum$
         1:
           &STATE     ^lametric_icon_sum$
         2:
           &STATE     ^lametric_icon_sum$
         3:
           &STATE     ^lametric_icon_sum$
       lmicon_duration:
         0:
           &STATE     ^lmicon_duration$
         1:
           &STATE     ^lmicon_duration$
   attr:
     cmdState:
     repeatcmd:
       [lmicon_duration]
     wait:
       0:
         [lmi_light]
         [lmi_post]
     waitdel:
   condition:
     0          ::InternalDoIf($hash,'lametric_icon_sum','STATE') > ::InternalDoIf($hash,'lmicon_duration','STATE')
     1          ::InternalDoIf($hash,'lametric_icon_sum','STATE') == ::InternalDoIf($hash,'lmicon_duration','STATE')
     2          ::InternalDoIf($hash,'lametric_icon_sum','STATE') == 0
     3          ::EventDoIf('MQTT2_wz_thermostat',$hash,'temperature',0) and ::InternalDoIf($hash,'lametric_icon_sum','STATE') == 0
   do:
     0:
       0          IF ([lmi_light] ne "0") (set MQTT2_Broker publish lametric/lametric_wz  {"frames":[  {"icon":"2448","text":"[MQTT2_wz_thermostat:temperature]°C"}  ]})
       1          IF ([lmi_post] ne "0") (set MQTT2_Broker publish lametric/lametric_wz  {"frames":[  {"icon":"23001","text":"[MQTT2_wz_thermostat:temperature]°C"}  ]})
     1:
       0          IF ([lmi_light] ne "0") (set MQTT2_Broker publish lametric/lametric_wz  {"frames":[  {"icon":"2448","text":"[MQTT2_wz_thermostat:temperature]°C"}  ]})
       1          IF ([lmi_post] ne "0") (set MQTT2_Broker publish lametric/lametric_wz  {"frames":[  {"icon":"23001","text":"[MQTT2_wz_thermostat:temperature]°C"}  ]})
     2:
       0          set MQTT2_Broker publish lametric/lametric_wz  {"frames":[  {"icon":"","text":"[MQTT2_wz_thermostat:temperature]°C"}]}
     3:
       0          set MQTT2_Broker publish lametric/lametric_wz  {"frames":[  {"icon":"","text":"[MQTT2_wz_thermostat:temperature]°C"}]}
     4:
   helper:
     NOTIFYDEV  .*(MQTT2_wz_thermostat).*,lametric_icon_sum,lmicon_duration,global
     event      low_temperature: 19
     globalinit 1
     last_timer 0
     sleeptimer -1
     timerdev   
     timerevent low_temperature: 19
     timerevents
     timereventsState
     triggerDev
   internals:
     all         lametric_icon_sum:STATE lmicon_duration:STATE
   readings:
   trigger:
   uiState:
   uiTable:
Attributes:
   repeatcmd  [lmicon_duration]
   wait       [lmi_light],[lmi_post]


Das ganze Konstrukt ist (für meine Verhältnisse) recht komplex. Das hier aufgeführte DOIF ist zur Veranschaulichung schon vereinfacht.

Grundsätzlich pusht das DOIF die aktuelle Wohnzimmertemperatur, ohne Icon auf die Lametric. Wenn bestimmte Bedingungen erfüllt sind, sollen je nach Bedingung ein oder mehrere Icons nacheinander angezeigt werden. Das hat vor dem Update der Lametric auch jahrelang problemlos funktioniert.

Falls da noch weitere Infos zu den Abhängigkeiten von beteiligten Dummies usw. nötig sind, kann ich die nachliefern.

Wie kann ich das Problem am besten lösen?

LG
Oli
PVE auf MiniPC (N100) mit FHEM, Zigbee2MQTT, Homebridge, DeConz