[gelöst] DOIF reagiert zu einer "falschen" Uhrzeit

Begonnen von Juggernaut, 14 Januar 2025, 07:40:42

Vorheriges Thema - Nächstes Thema

Juggernaut

Hallo,
ich komme gerade an einem DOIF nicht weiter und hoffe ihr könnt mir einen Schubs in die richtige Richtung geben.

Leider muss ich dazu erst mal erklären was ich genau mit dem DOIF vorhabe:
Ich würde gerne die Zirkulationspumpe für mein Warmwasser etwas intelligenter steuern.
Aktuell hängt eine Wochenzeitschaltuhr dran, die aber z.B. jetzt über die Weihnachtsfeiertage nicht optimal funktioniert.

Durch meine Rollladensteuerung weiß FHEM schon wann ich "normal da bin" das wäre der "Automatik_AnwStatus" "Arbeiten". Wenn ich Urlaub habe, und zu Hause bin steht dort "Frei" und wenn ich Urlaub habe und nicht zu Hause bin ist der Status "Weg". Das funktioniert über einen Kalendereintrag den sich FHEM holt. Das wird 1x pro Stunde jeweils um XX:30 aktualisiert.
Das funktioniert auch für die Rollläden schon einigen Jahre.
Außerdem habe ich noch 2 Dummys.
Dummy 1 ist "Uhr_Zirkulation_aktiviert", den nutze ich um die Automatik der Z-Pumpe zu aktivieren bzw. deaktivieren.
Dummy 2 ist "Zirkulation_An", den möchte ich in Zukunft nutzen um bei bedarf doch mal per Alexa die Z-Pumpe für 5 Minuten einzuschalten falls ich zu einer "ungewöhnlichen" Zeit Warmwasser haben möchte. Aber das kommt wie gesagt erst später und dort ist bisher nur der Dummy angelegt noch keine Schaltfunktion.

Jetzt zu meinem Problem:
Es funktionieren alle Zeiten bis auf 05:30 bis 07:30 an Arbeitstagen. Diese eine Schaltzeit funktioniert zuverlässig von 05:30 bis 07:00. Ich verstehe nicht warum diese eine Schaltzeit immer zuverlässig eine halbe Stunde zu kurz ist. Alles andere funktioniert!
Muss ich das DOIF anders aufbauen? Sind zu viele ODERs in der Klammer? Habt ihr eine Idee woran das liegen könnte?

Danke schon mal!

Hier ist noch die Kopie fürs Forum von besagtem DOIF.

define Zirkulation_Automatik DOIF ([Uhr_Zirkulation_aktiviert] eq "Aktiv" and [Automatik_AnwStatus] eq "Arbeiten" and ([05:30-07:30|AT] or [15:00-21:00|AT] or [14:15-14:55|Fr] or [07:00-21:00|WE])) \
    (set ShellyPlug on)(set Zirkulation_An Aktiv)\
DOELSEIF\
([Uhr_Zirkulation_aktiviert] eq "Aktiv" and [Automatik_AnwStatus] eq "Frei" and [07:00-21:00]) \
    (set ShellyPlug on)(set Zirkulation_An Aktiv)\
DOELSE\
    (set ShellyPlug off)(set Zirkulation_An Inaktiv)
attr Zirkulation_Automatik alias Zirkulation_Automatik
attr Zirkulation_Automatik group 6_Zirkulation
attr Zirkulation_Automatik room Zeitschaltuhren
#   CFGFN     
#   DEF        ([Uhr_Zirkulation_aktiviert] eq "Aktiv" and [Automatik_AnwStatus] eq "Arbeiten" and ([05:30-07:30|AT] or [15:00-21:00|AT] or [14:15-14:55|Fr] or [07:00-21:00|WE]))
#    (set ShellyPlug on)(set Zirkulation_An Aktiv)
#DOELSEIF
#([Uhr_Zirkulation_aktiviert] eq "Aktiv" and [Automatik_AnwStatus] eq "Frei" and [07:00-21:00])
#    (set ShellyPlug on)(set Zirkulation_An Aktiv)
#DOELSE
#    (set ShellyPlug off)(set Zirkulation_An Inaktiv)
#   FUUID      677e76dd-f33f-f812-9cd0-029a421d2e8d7a79
#   MODEL      FHEM
#   NAME       Zirkulation_Automatik
#   NOTIFYDEV  global,Automatik_AnwStatus,Uhr_Zirkulation_aktiviert
#   NR         21571
#   NTFY_ORDER 50-Zirkulation_Automatik
#   STATE      cmd_3
#   TYPE       DOIF
#   VERSION    29460 2024-12-29 20:25:48
#   eventCount 59
#   READINGS:
#     2025-01-14 07:00:00   cmd             3.2
#     2025-01-14 07:00:00   cmd_event       timer_9
#     2025-01-14 07:00:00   cmd_nr          3
#     2025-01-14 07:00:00   cmd_seqnr       2
#     2025-01-13 07:04:49   mode            enabled
#     2025-01-14 07:00:00   state           cmd_3
#     2025-01-13 07:30:00   timer_01_c01    14.01.2025 05:30:00|AT
#     2025-01-13 07:30:00   timer_02_c01    14.01.2025 07:30:00|AT
#     2025-01-13 21:00:00   timer_03_c01    14.01.2025 15:00:00|AT
#     2025-01-13 21:00:00   timer_04_c01    14.01.2025 21:00:00|AT
#     2025-01-13 14:55:00   timer_05_c01    14.01.2025 14:15:00|Fr
#     2025-01-13 14:55:00   timer_06_c01    14.01.2025 14:55:00|Fr
#     2025-01-13 21:00:00   timer_07_c01    14.01.2025 07:00:00|WE
#     2025-01-13 21:00:00   timer_08_c01    14.01.2025 21:00:00|WE
#     2025-01-13 21:00:00   timer_09_c02    14.01.2025 07:00:00
#     2025-01-13 21:00:00   timer_10_c02    14.01.2025 21:00:00
#   Regex:
#     accu:
#     bar:
#     barAvg:
#     collect:
#     cond:
#       Automatik_AnwStatus:
#         0:
#           &STATE     ^Automatik_AnwStatus$
#         1:
#           &STATE     ^Automatik_AnwStatus$
#       Uhr_Zirkulation_aktiviert:
#         0:
#           &STATE     ^Uhr_Zirkulation_aktiviert$
#         1:
#           &STATE     ^Uhr_Zirkulation_aktiviert$
#   attr:
#     cmdState:
#     wait:
#     waitdel:
#   condition:
#     0          ::InternalDoIf($hash,'Uhr_Zirkulation_aktiviert','STATE') eq "Aktiv" and ::InternalDoIf($hash,'Automatik_AnwStatus','STATE') eq "Arbeiten" and (::DOIF_time($hash,0,1,$wday,$hms,"AT") or ::DOIF_time($hash,2,3,$wday,$hms,"AT") or ::DOIF_time($hash,4,5,$wday,$hms,"Fr") or ::DOIF_time($hash,6,7,$wday,$hms,"WE"))
#     1          ::InternalDoIf($hash,'Uhr_Zirkulation_aktiviert','STATE') eq "Aktiv" and ::InternalDoIf($hash,'Automatik_AnwStatus','STATE') eq "Frei" and ::DOIF_time($hash,8,9,$wday,$hms)
#   days:
#     0          AT
#     1          AT
#     2          AT
#     3          AT
#     4          Fr
#     5          Fr
#     6          WE
#     7          WE
#   do:
#     0:
#       0          set ShellyPlug on
#       1          set Zirkulation_An Aktiv
#     1:
#       0          set ShellyPlug on
#       1          set Zirkulation_An Aktiv
#     2:
#       0          set ShellyPlug off
#       1          set Zirkulation_An Inaktiv
#   helper:
#     NOTIFYDEV  global,Automatik_AnwStatus,Uhr_Zirkulation_aktiviert
#     event      timer_9
#     globalinit 1
#     last_timer 10
#     sleeptimer -1
#     timerdev  
#     timerevent timer_9
#     triggerDev
#     DOIF_eventa:
#       cmd_nr: 3
#       cmd_seqnr: 2
#       cmd_event: timer_9
#       cmd_3
#     DOIF_eventas:
#       cmd_nr: 3
#       cmd_seqnr: 2
#       cmd_event: timer_9
#       state: cmd_3
#     timerevents:
#       timer_9
#     timereventsState:
#       timer_9
#     triggerEvents:
#       timer_9
#     triggerEventsState:
#       timer_9
#   internals:
#     all         Uhr_Zirkulation_aktiviert:STATE Automatik_AnwStatus:STATE
#   interval:
#     0          -1
#     1          0
#     2          -1
#     3          2
#     4          -1
#     5          4
#     6          -1
#     7          6
#     8          -1
#     9          8
#   intervalfunc:
#   intervaltimer:
#   localtime:
#     0          1736829000
#     1          1736836200
#     2          1736863200
#     3          1736884800
#     4          1736860500
#     5          1736862900
#     6          1736834400
#     7          1736884800
#     8          1736834400
#     9          1736884800
#   realtime:
#     0          05:30:00
#     1          07:30:00
#     2          15:00:00
#     3          21:00:00
#     4          14:15:00
#     5          14:55:00
#     6          07:00:00
#     7          21:00:00
#     8          07:00:00
#     9          21:00:00
#   time:
#     0          05:30:00
#     1          07:30:00
#     2          15:00:00
#     3          21:00:00
#     4          14:15:00
#     5          14:55:00
#     6          07:00:00
#     7          21:00:00
#     8          07:00:00
#     9          21:00:00
#   timeCond:
#     0          0
#     1          0
#     2          0
#     3          0
#     4          0
#     5          0
#     6          0
#     7          0
#     8          1
#     9          1
#   timer:
#     0          0
#     1          0
#     2          0
#     3          0
#     4          0
#     5          0
#     6          0
#     7          0
#     8          0
#     9          0
#   timers:
#     0           0  1  2  3  4  5  6  7
#     1           8  9
#   triggertime:
#     1736836200:
#       localtime  1736836200
#       hash:
#     1736860500:
#       localtime  1736860500
#       hash:
#     1736862900:
#       localtime  1736862900
#       hash:
#     1736863200:
#       localtime  1736863200
#       hash:
#     1736884800:
#       localtime  1736884800
#       hash:
#   uiState:
#   uiTable:
#
setstate Zirkulation_Automatik cmd_3
setstate Zirkulation_Automatik 2025-01-14 07:00:00 cmd 3.2
setstate Zirkulation_Automatik 2025-01-14 07:00:00 cmd_event timer_9
setstate Zirkulation_Automatik 2025-01-14 07:00:00 cmd_nr 3
setstate Zirkulation_Automatik 2025-01-14 07:00:00 cmd_seqnr 2
setstate Zirkulation_Automatik 2025-01-13 07:04:49 mode enabled
setstate Zirkulation_Automatik 2025-01-14 07:00:00 state cmd_3
setstate Zirkulation_Automatik 2025-01-13 07:30:00 timer_01_c01 14.01.2025 05:30:00|AT
setstate Zirkulation_Automatik 2025-01-13 07:30:00 timer_02_c01 14.01.2025 07:30:00|AT
setstate Zirkulation_Automatik 2025-01-13 21:00:00 timer_03_c01 14.01.2025 15:00:00|AT
setstate Zirkulation_Automatik 2025-01-13 21:00:00 timer_04_c01 14.01.2025 21:00:00|AT
setstate Zirkulation_Automatik 2025-01-13 14:55:00 timer_05_c01 14.01.2025 14:15:00|Fr
setstate Zirkulation_Automatik 2025-01-13 14:55:00 timer_06_c01 14.01.2025 14:55:00|Fr
setstate Zirkulation_Automatik 2025-01-13 21:00:00 timer_07_c01 14.01.2025 07:00:00|WE
setstate Zirkulation_Automatik 2025-01-13 21:00:00 timer_08_c01 14.01.2025 21:00:00|WE
setstate Zirkulation_Automatik 2025-01-13 21:00:00 timer_09_c02 14.01.2025 07:00:00
setstate Zirkulation_Automatik 2025-01-13 21:00:00 timer_10_c02 14.01.2025 21:00:00


Damian

#1
Um 07:00 Uhr wird dein Device getriggert wegen zweiter Bedingung, diese ist aber nicht wahr, daher geht er in den DOELSE-Zweig.

Tipp, fasse die beiden Bedingungen zu einer zusammen.
Programmierte FHEM-Module: DOIF-FHEM, DOIF-Perl, DOIF-uiTable, THRESHOLD, FHEM-Befehl: IF

Juggernaut

Alles klar. Da hatte ich wohl einen Denkfehler. Dachte das DOELSEIF wird nur abgefragt wenn das DOIF "false" ist.
Hab es jetzt umgestellt und werde die Tage berichten ob es funktioniert hat.

Danke!

Sieht jetzt so aus:
([Uhr_Zirkulation_aktiviert] eq "Aktiv" and (([Automatik_AnwStatus] eq "Arbeiten" and ([05:30-07:30|AT] or [15:00-21:00|AT] or [14:15-14:55|Fr] or [07:00-21:00|WE])) or ([Automatik_AnwStatus] eq "Frei" and [07:00-21:00])))
(set ShellyPlug on)(set Zirkulation_An Aktiv)
DOELSE
(set ShellyPlug off)(set Zirkulation_An Inaktiv)

Juggernaut

Habe es jetzt 2 Tage getestet und es funktioniert. ;D

Vielen Dank noch mal!!!