Frage zu DOIF Statement mit Zeiträumen

Begonnen von FhemPiUser, 26 Juni 2022, 12:16:28

Vorheriges Thema - Nächstes Thema

FhemPiUser

Ich habe folgendes DOIF Statement:

di_test DOIF ((...) and ([05:00-11:30])  (...) DOELSEIF ((...) and ([11:30-17:00])) (...) DOELSE (...)

Heute um 12:00 Uhr war der DOIF in cmd3, also im DOELSE. Die "..." conditions waren auf jeden Fall true. Bei einem manuell ausgeführtem "checkall" ging er dann auch in den korrekten cmd2. Wie kann das sein?

Damian

Zitat von: FhemPiUser am 26 Juni 2022, 12:16:28
Ich habe folgendes DOIF Statement:

di_test DOIF ((...) and ([05:00-11:30])  (...) DOELSEIF ((...) and ([11:30-17:00])) (...) DOELSE (...)

Heute um 12:00 Uhr war der DOIF in cmd3, also im DOELSE. Die "..." conditions waren auf jeden Fall true. Bei einem manuell ausgeführtem "checkall" ging er dann auch in den korrekten cmd2. Wie kann das sein?

Im Reading cmd_event kannst du sehen, welches Device den DOELSE-Fall ausgelöst hat.
Programmierte FHEM-Module: DOIF-FHEM, DOIF-Perl, DOIF-uiTable, THRESHOLD, FHEM-Befehl: IF

FhemPiUser

Ja, merkwürdig, das ist ein Device das nur im cmd1 vorkommt und nicht in cmd2 oder cmd3. Wie kann dann cmd3 ausgeführt werden, obwohl cmd2 richtig wäre.

Damian

Zitat von: FhemPiUser am 26 Juni 2022, 13:57:31
Ja, merkwürdig, das ist ein Device das nur im cmd1 vorkommt und nicht in cmd2 oder cmd3. Wie kann dann cmd3 ausgeführt werden, obwohl cmd2 richtig wäre.

Alles steht und fällt mit deiner Definition, die wir hier nicht sehen können. Bevor man dazu was Sinnvolles sagen kann, musst du den vermeintlich falschen Zustand per list posten.
Programmierte FHEM-Module: DOIF-FHEM, DOIF-Perl, DOIF-uiTable, THRESHOLD, FHEM-Befehl: IF

FhemPiUser

#4
Ja, sorry. Geht um eine Akku-Ladesteuerung für eine PV-Anlage. Die Definition war

defmod di_PV_Akku_Ladesteuerung_Max_SOC DOIF (([PV_forecast_heute] > 30) and ([05:00-11:30]) and ( $month >= 3 && $month <= 10 )) ({fhem("set SH10rt_1 Max_SOC ".(ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "50") > 50 ? (ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "50")*10) : 500))}) DOELSEIF (($month >= 3 && $month <= 10) and ([11:30-17:00])) ({fhem("set SH10rt_1 Max_SOC ".(ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "90") > 90 ? (ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "90")*10) : 900))}) DOELSE (set SH10rt_1 Max_SOC 990)

Habe sie jetzt angepasst und das PV_forecast_heute auch in die 2. Condition eingefügt (S.u.). Bisher funktioniert es.

defmod di_PV_Akku_Ladesteuerung_Max_SOC DOIF (([PV_forecast_heute] > 30) and ([05:00-11:30]) and ( $month >= 3 && $month <= 10 )) ({fhem("set SH10rt_1 Max_SOC ".(ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "50") > 50 ? (ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "50")*10) : 500))}) DOELSEIF (([PV_forecast_heute] > 30) and ($month >= 3 && $month <= 10) and ([11:30-17:00])) ({fhem("set SH10rt_1 Max_SOC ".(ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "90") > 90 ? (ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "90")*10) : 900))}) DOELSE (set SH10rt_1 Max_SOC 990)

Ganz klar ist mir aber nicht, warum das notwendig zu sein scheint. Wird die zweite Condition nur mit [11:30-17:00] garnicht geprüft, falls die erste Condition falsch wird in dem Zeitraum nach 11:30?

MadMax-FHEM

Zitat
musst du den vermeintlich falschen Zustand per list posten.

Fehlt immer noch...

and und && mischen ist auch nicht "toll"... ;)

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

FhemPiUser

ok, anbei der list

Internals:
   CFGFN     
   DEF        (([PV_forecast_heute] > 30) and ([05:00-11:30]) and ( $month >= 3 && $month <= 10 )) ({fhem("set SH10rt_1 Max_SOC ".(ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "50") > 50 ? (ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "50")*10) : 500))}) DOELSEIF (([PV_forecast_heute] > 30) and ($month >= 3 && $month <= 10) and ([11:30-17:00])) ({fhem("set SH10rt_1 Max_SOC ".(ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "90") > 90 ? (ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "90")*10) : 900))}) DOELSE (set SH10rt_1 Max_SOC 990)
   FUUID      62b47f95-f33f-be48-6293-80668f95063e3f2a
   MODEL      FHEM
   NAME       di_PV_Akku_Ladesteuerung_Max_SOC
   NOTIFYDEV  PV_forecast_heute,global
   NR         2411824
   NTFY_ORDER 50-di_PV_Akku_Ladesteuerung_Max_SOC
   STATE      cmd_2
   TYPE       DOIF
   VERSION    26020 2022-05-03 16:28:02
   eventCount 28
   READINGS:
     2022-06-26 15:25:00   cmd             2
     2022-06-26 15:25:00   cmd_event       di_PV_Akku_Ladesteuerung_Max_SOC
     2022-06-26 15:25:00   cmd_nr          2
     2022-06-26 15:24:39   mode            enabled
     2022-06-26 15:25:00   state           cmd_2
     2022-06-26 15:24:39   timer_01_c01    27.06.2022 05:00:00
     2022-06-26 15:24:39   timer_02_c01    27.06.2022 11:30:00
     2022-06-26 15:24:39   timer_03_c02    27.06.2022 11:30:00
     2022-06-26 15:24:39   timer_04_c02    26.06.2022 17:00:00
   Regex:
     accu:
     collect:
     cond:
       PV_forecast_heute:
         0:
           &STATE     ^PV_forecast_heute$
         1:
           &STATE     ^PV_forecast_heute$
   attr:
     cmdState:
     wait:
     waitdel:
   condition:
     0          (::InternalDoIf($hash,'PV_forecast_heute','STATE') > 30) and (::DOIF_time($hash,0,1,$wday,$hms)) and ( $month >= 3 && $month <= 10 )
     1          (::InternalDoIf($hash,'PV_forecast_heute','STATE') > 30) and ($month >= 3 && $month <= 10) and (::DOIF_time($hash,2,3,$wday,$hms))
   days:
   do:
     0:
       0          {fhem("set SH10rt_1 Max_SOC ".(ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "50") > 50 ? (ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "50")*10) : 500))}
     1:
       0          {fhem("set SH10rt_1 Max_SOC ".(ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "90") > 90 ? (ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "90")*10) : 900))}
     2:
       0          set SH10rt_1 Max_SOC 990
   helper:
     NOTIFYDEV  PV_forecast_heute,global
     globalinit 1
     last_timer 4
     sleeptimer -1
     timerdev   
     timerevent
     timerevents
     timereventsState
     triggerDev
     DOIF_eventa:
       cmd_nr: 2
       cmd: 2
       cmd_event: di_PV_Akku_Ladesteuerung_Max_SOC
       cmd_2
     DOIF_eventas:
       cmd_nr: 2
       cmd: 2
       cmd_event: di_PV_Akku_Ladesteuerung_Max_SOC
       state: cmd_2
   internals:
     all         PV_forecast_heute:STATE
   interval:
     0          -1
     1          0
     2          -1
     3          2
   intervalfunc:
   localtime:
     0          1656298800
     1          1656322200
     2          1656322200
     3          1656255600
   realtime:
     0          05:00:00
     1          11:30:00
     2          11:30:00
     3          17:00:00
   time:
     0          05:00:00
     1          11:30:00
     2          11:30:00
     3          17:00:00
   timeCond:
     0          0
     1          0
     2          1
     3          1
   timer:
     0          0
     1          0
     2          0
     3          0
   timers:
     0           0  1
     1           2  3
   triggertime:
     1656255600:
       localtime  1656255600
       hash:
     1656298800:
       localtime  1656298800
       hash:
     1656322200:
       localtime  1656322200
       hash:
   uiState:
   uiTable:
Attributes:
   disable    0
   room       PV-Anlage

MadMax-FHEM

Zitat von: FhemPiUser am 26 Juni 2022, 15:35:29
ok, anbei der list

Internals:
   CFGFN     
   DEF        (([PV_forecast_heute] > 30) and ([05:00-11:30]) and ( $month >= 3 && $month <= 10 )) ({fhem("set SH10rt_1 Max_SOC ".(ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "50") > 50 ? (ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "50")*10) : 500))}) DOELSEIF (([PV_forecast_heute] > 30) and ($month >= 3 && $month <= 10) and ([11:30-17:00])) ({fhem("set SH10rt_1 Max_SOC ".(ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "90") > 90 ? (ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "90")*10) : 900))}) DOELSE (set SH10rt_1 Max_SOC 990)
   FUUID      62b47f95-f33f-be48-6293-80668f95063e3f2a
   MODEL      FHEM
   NAME       di_PV_Akku_Ladesteuerung_Max_SOC
   NOTIFYDEV  PV_forecast_heute,global
   NR         2411824
   NTFY_ORDER 50-di_PV_Akku_Ladesteuerung_Max_SOC
   STATE      cmd_2
   TYPE       DOIF
   VERSION    26020 2022-05-03 16:28:02
   eventCount 28
   READINGS:
     2022-06-26 15:25:00   cmd             2
     2022-06-26 15:25:00   cmd_event       di_PV_Akku_Ladesteuerung_Max_SOC
     2022-06-26 15:25:00   cmd_nr          2
     2022-06-26 15:24:39   mode            enabled
     2022-06-26 15:25:00   state           cmd_2
     2022-06-26 15:24:39   timer_01_c01    27.06.2022 05:00:00
     2022-06-26 15:24:39   timer_02_c01    27.06.2022 11:30:00
     2022-06-26 15:24:39   timer_03_c02    27.06.2022 11:30:00
     2022-06-26 15:24:39   timer_04_c02    26.06.2022 17:00:00
   Regex:
     accu:
     collect:
     cond:
       PV_forecast_heute:
         0:
           &STATE     ^PV_forecast_heute$
         1:
           &STATE     ^PV_forecast_heute$
   attr:
     cmdState:
     wait:
     waitdel:
   condition:
     0          (::InternalDoIf($hash,'PV_forecast_heute','STATE') > 30) and (::DOIF_time($hash,0,1,$wday,$hms)) and ( $month >= 3 && $month <= 10 )
     1          (::InternalDoIf($hash,'PV_forecast_heute','STATE') > 30) and ($month >= 3 && $month <= 10) and (::DOIF_time($hash,2,3,$wday,$hms))
   days:
   do:
     0:
       0          {fhem("set SH10rt_1 Max_SOC ".(ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "50") > 50 ? (ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "50")*10) : 500))}
     1:
       0          {fhem("set SH10rt_1 Max_SOC ".(ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "90") > 90 ? (ReadingsVal("SH10rt_1","Battery_Level_korrigiert", "90")*10) : 900))}
     2:
       0          set SH10rt_1 Max_SOC 990
   helper:
     NOTIFYDEV  PV_forecast_heute,global
     globalinit 1
     last_timer 4
     sleeptimer -1
     timerdev   
     timerevent
     timerevents
     timereventsState
     triggerDev
     DOIF_eventa:
       cmd_nr: 2
       cmd: 2
       cmd_event: di_PV_Akku_Ladesteuerung_Max_SOC
       cmd_2
     DOIF_eventas:
       cmd_nr: 2
       cmd: 2
       cmd_event: di_PV_Akku_Ladesteuerung_Max_SOC
       state: cmd_2
   internals:
     all         PV_forecast_heute:STATE
   interval:
     0          -1
     1          0
     2          -1
     3          2
   intervalfunc:
   localtime:
     0          1656298800
     1          1656322200
     2          1656322200
     3          1656255600
   realtime:
     0          05:00:00
     1          11:30:00
     2          11:30:00
     3          17:00:00
   time:
     0          05:00:00
     1          11:30:00
     2          11:30:00
     3          17:00:00
   timeCond:
     0          0
     1          0
     2          1
     3          1
   timer:
     0          0
     1          0
     2          0
     3          0
   timers:
     0           0  1
     1           2  3
   triggertime:
     1656255600:
       localtime  1656255600
       hash:
     1656298800:
       localtime  1656298800
       hash:
     1656322200:
       localtime  1656322200
       hash:
   uiState:
   uiTable:
Attributes:
   disable    0
   room       PV-Anlage


Ist doch nicht das Original-DOIF im Fehlerzustand!

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

FhemPiUser

nein, das aktuelle. Den Fehlerfall habe ich leider nicht als list gespeichert. Muss ich morgen mal schauen, ob es nochmal auftritt und dann als list speichern.

Neu ist aber nur das pv_forecast_heute in condition2

Damian

Zitat von: FhemPiUser am 26 Juni 2022, 15:28:59
Ganz klar ist mir aber nicht, warum das notwendig zu sein scheint. Wird die zweite Condition nur mit [11:30-17:00] garnicht geprüft, falls die erste Condition falsch wird in dem Zeitraum nach 11:30?

Zitat aus der Einleitung zu DOIF in der Commandref:

ZitatZu beachten ist, dass nur die Bedingungen überprüft werden, die zum ausgelösten Event das dazughörige Device bzw. die dazugehörige Triggerzeit beinhalten.
Programmierte FHEM-Module: DOIF-FHEM, DOIF-Perl, DOIF-uiTable, THRESHOLD, FHEM-Befehl: IF

FhemPiUser

ahh, danke, das erklärt es!

sorry, hatte ich wohl überlesen