[gelöst]: 2 Befehlszweige: cmd_1 und cmd_2

Begonnen von Gisbert, 23 August 2021, 20:27:37

Vorheriges Thema - Nächstes Thema

Gisbert

Hallo Damian,

ich verstehe nicht, warum das angehängte DOIF 2 Befehlszweige (cmd_1 und cmd_2) hat. Ich habe einen Befehlszweig erwartet, bekomme aber zwei. Das DOIF-Device wurde basierend auf einem Event erstellt und um die "and"-Erweiterungen ergänzt. Bei der Änderung der Definition waren nur "legale" von Fhem bereitgestellt Mittel im Einsatz; d.h. keine cfg-Editierung.

Das list:
Internals:
   CFGFN     
   DEF        ([myreadingsWatcher:"^Klingel_Klingel.System.Info:.timeout$"] and
[myreadingsWatcher:"^Pulsemeter_Pulsemeter.System.Info:.timeout$"] and
[myreadingsWatcher:"^Stellantriebe.EG_EG.System.Info:.timeout$"] and
[myreadingsWatcher:"^Temp.EG_EG.System.Info:.timeout$"])
(set myUniFi restartAP UAP-AC-LR-EG)
   FUUID      612370cb-f33f-e986-caaa-aac51ca7f3ca5513
   MODEL      FHEM
   NAME       myreadingsWatcher_UAP_AC_LR_EG
   NOTIFYDEV  myreadingsWatcher,global
   NR         6324
   NTFY_ORDER 50-myreadingsWatcher_DOIF_1
   STATE      UAP AC-LR-EG: ok
   TYPE       DOIF
   VERSION    24755 2021-07-15 16:40:59
   READINGS:
     2021-08-23 20:22:58   Device          myreadingsWatcher
     2021-08-23 20:16:57   cmd             2
     2021-08-23 20:16:57   cmd_event       myreadingsWatcher_UAP_AC_LR_EG
     2021-08-23 20:16:57   cmd_nr          2
     2021-08-23 20:22:58   e_myreadingsWatcher_events Klingel_Klingel.System.Info: ok,Lichtstaerke_BH1750_Illuminance: ok,Lichtstaerke.West_MAX44009_Illuminance: ok,Pulsemeter_Pulsemeter.System.Info: ok,Stellantriebe.EG_EG.System.Info: ok,Temp.EG_EG.System.Info: ok,readings: 6,devices: 6,alive: 6,dead: 0,skipped: 0,timeouts: 0,ok,timeoutDevs: none,deadDevs: none,skippedDevs: none
     2021-08-23 20:16:04   mode            enabled
     2021-08-23 20:16:57   state           cmd_2
   Regex:
     accu:
     collect:
     cond:
       myreadingsWatcher:
         0:
           &STATE     ^myreadingsWatcher$
   attr:
     cmdState:
     wait:
     waitdel:
   condition:
     0          ::EventDoIf('myreadingsWatcher',$hash,'^Klingel_Klingel.System.Info:.timeout$',1) and  ::EventDoIf('myreadingsWatcher',$hash,'^Pulsemeter_Pulsemeter.System.Info:.timeout$',1) and  ::EventDoIf('myreadingsWatcher',$hash,'^Stellantriebe.EG_EG.System.Info:.timeout$',1) and  ::EventDoIf('myreadingsWatcher',$hash,'^Temp.EG_EG.System.Info:.timeout$',1)
   do:
     0:
       0          set myUniFi restartAP UAP-AC-LR-EG
     1:
   helper:
     DEVFILTER  ^global$|^myreadingsWatcher$
     NOTIFYDEV  global|myreadingsWatcher
     event      Klingel_Klingel.System.Info: ok,Lichtstaerke_BH1750_Illuminance: ok,Lichtstaerke.West_MAX44009_Illuminance: ok,Pulsemeter_Pulsemeter.System.Info: ok,Stellantriebe.EG_EG.System.Info: ok,Temp.EG_EG.System.Info: ok,readings: 6,devices: 6,alive: 6,dead: 0,skipped: 0,timeouts: 0,ok,timeoutDevs: none,deadDevs: none,skippedDevs: none
     globalinit 1
     last_timer 0
     sleeptimer -1
     timerdev   myreadingsWatcher
     timerevent Klingel_Klingel.System.Info: ok,Lichtstaerke_BH1750_Illuminance: ok,Lichtstaerke.West_MAX44009_Illuminance: ok,Pulsemeter_Pulsemeter.System.Info: ok,Stellantriebe.EG_EG.System.Info: ok,Temp.EG_EG.System.Info: ok,readings: 6,devices: 6,alive: 6,dead: 0,skipped: 0,timeouts: 0,ok,timeoutDevs: none,deadDevs: none,skippedDevs: none
     triggerDev myreadingsWatcher
     bm:
       DOIF_Get:
         cnt        1
         dmx        -1000
         dtot       0
         dtotcnt    0
         mTS        23.08. 20:16:57
         max        1.97887420654297e-05
         tot        1.97887420654297e-05
         mAr:
           HASH(0x55810f159e60)
           myreadingsWatcher_UAP_AC_LR_EG
           ?
       DOIF_Notify:
         cnt        6
         dmx        -1000
         dtot       0
         dtotcnt    0
         mTS        23.08. 20:20:58
         max        0.00165796279907227
         tot        0.0069737434387207
         mAr:
           HASH(0x55810f159e60)
           HASH(0x55810cc6fce8)
       DOIF_Set:
         cnt        6
         dmx        -1000
         dtot       0
         dtotcnt    0
         mTS        23.08. 20:16:57
         max        0.0376739501953125
         tot        0.0381460189819336
         mAr:
           HASH(0x55810f159e60)
           myreadingsWatcher_UAP_AC_LR_EG
           checkall
     timerevents:
       Klingel_Klingel.System.Info: ok
       Lichtstaerke_BH1750_Illuminance: ok
       Lichtstaerke.West_MAX44009_Illuminance: ok
       Pulsemeter_Pulsemeter.System.Info: ok
       Stellantriebe.EG_EG.System.Info: ok
       Temp.EG_EG.System.Info: ok
       readings: 6
       devices: 6
       alive: 6
       dead: 0
       skipped: 0
       timeouts: 0
       ok
       timeoutDevs: none
       deadDevs: none
       skippedDevs: none
     timereventsState:
       Klingel_Klingel.System.Info: ok
       Lichtstaerke_BH1750_Illuminance: ok
       Lichtstaerke.West_MAX44009_Illuminance: ok
       Pulsemeter_Pulsemeter.System.Info: ok
       Stellantriebe.EG_EG.System.Info: ok
       Temp.EG_EG.System.Info: ok
       readings: 6
       devices: 6
       alive: 6
       dead: 0
       skipped: 0
       timeouts: 0
       state: ok
       timeoutDevs: none
       deadDevs: none
       skippedDevs: none
     triggerEvents:
       Klingel_Klingel.System.Info: ok
       Lichtstaerke_BH1750_Illuminance: ok
       Lichtstaerke.West_MAX44009_Illuminance: ok
       Pulsemeter_Pulsemeter.System.Info: ok
       Stellantriebe.EG_EG.System.Info: ok
       Temp.EG_EG.System.Info: ok
       readings: 6
       devices: 6
       alive: 6
       dead: 0
       skipped: 0
       timeouts: 0
       ok
       timeoutDevs: none
       deadDevs: none
       skippedDevs: none
     triggerEventsState:
       Klingel_Klingel.System.Info: ok
       Lichtstaerke_BH1750_Illuminance: ok
       Lichtstaerke.West_MAX44009_Illuminance: ok
       Pulsemeter_Pulsemeter.System.Info: ok
       Stellantriebe.EG_EG.System.Info: ok
       Temp.EG_EG.System.Info: ok
       readings: 6
       devices: 6
       alive: 6
       dead: 0
       skipped: 0
       timeouts: 0
       state: ok
       timeoutDevs: none
       deadDevs: none
       skippedDevs: none
   internals:
   readings:
   trigger:
     all         myreadingsWatcher
   uiState:
   uiTable:
Attributes:
   alias      UniFi AP EG
   icon       it_wifi
   room       Network
   stateFormat UAP AC-LR-EG: [myUniFi:-AP_UAP-AC-LR-EG_state]


Viele Grüße Gisbert
Aktuelles FHEM | PROXMOX | Fujitsu Futro S740 | Debian 12 | UniFi | Homematic, VCCU, HMUART | ESP8266 | ATtiny85 | Wasser-, Stromzähler | Wlan-Kamera | SIGNALduino, Flamingo Rauchmelder FA21/22RF | RHASSPY

Otto123

Hallo Gisbert,

alles richtig gemacht, cmd_2 ist die Alternative zu cmd_1 - in deinem Fall einfach nix. Also die Bedingung 1 ergibt falsch ;) und dann macht er symbolisch cmd_2

Gruß Otto
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

Gisbert

Hallo Otto,

deine Erklärung macht Sinn, danke dafür.
Das in den Tiefen der commandref oder des Forums zu suchen, erschien mir wenig sinnvoll, da es an Treffern zu den Suchworten nur so wimmelt und eine Eingrenzung nicht in Sicht war.

Viele Grüße Gisbert
Aktuelles FHEM | PROXMOX | Fujitsu Futro S740 | Debian 12 | UniFi | Homematic, VCCU, HMUART | ESP8266 | ATtiny85 | Wasser-, Stromzähler | Wlan-Kamera | SIGNALduino, Flamingo Rauchmelder FA21/22RF | RHASSPY

Damian

Zitat von: Gisbert am 23 August 2021, 20:50:03
Hallo Otto,

deine Erklärung macht Sinn, danke dafür.
Das in den Tiefen der commandref oder des Forums zu suchen, erschien mir wenig sinnvoll, da es an Treffern zu den Suchworten nur so wimmelt und eine Eingrenzung nicht in Sicht war.

Viele Grüße Gisbert

Warum es so ist, erkläre ich gerne noch mal.

Wenn ein DOIF nur einen Zweig hat und kein do always-Attribut, dann könnte man nur einmal schalten und das war´s.

Deswegen wird in diesem Fall ein "imaginärer" cmd_2-Fall gesetzt, damit man eine Chance hat aus dem cmd_1-Fall wieder herauszukommen.

Wenn dagegen bei einem Zweig do always-Attribut gesetzt wird, dann ist ja eine Wiederholung von cmd_1 möglich - hier gibt es das Problem nicht. Deswegen wird in diesem Fall kein "imaginärer" cmd_2-Fall im sonst-Fall erzeugt. Wenn man bei do always mit einem Zweig cmd_2 haben will, dann muss man logischerweise DOELSE ohne weitere Befehle an die Definition einfach anhängen.
Programmierte FHEM-Module: DOIF-FHEM, DOIF-Perl, DOIF-uiTable, THRESHOLD, FHEM-Befehl: IF