FHEM Forum

FHEM => Automatisierung => DOIF => Thema gestartet von: oelidoc am 08 August 2020, 18:21:30

Titel: [Gelöst] DOELSEIF Sequence Beschattung
Beitrag von: oelidoc am 08 August 2020, 18:21:30
Hallo,
bei uns wandert die Sonne um ein Eckhaus herum und bescheint dabei nacheinander mehrere Fenster, die sequentiell beschattet werden sollen. Das ganze soll auf Wunsch der Regierung aber von Hand eingeschaltet und dann abhängig von bestimmten Uhrzeiten automatisch ablaufen.

Ich habe ein bestehendes DOIF wie folgte erweitert:
(["$SELF:state: on"]) (set Jalousie[3-5] pct 30)
DOELSEIF (["$SELF:state: on"] and [13:30]) (set Jalousie6 pct 30; set Jalousie7 pct 15)
DOELSEIF (["$SELF:state: on"] and [14:30]) (set Jalousie[3-5] on)
DOELSEIF (["$SELF:state: on"] and [17:00]) (set Jalousie8 pct 15; set Jalousie1 pct 30)
DOELSEIF (["$SELF:state: on"] and [18:30]) (set Jalousie[6-7] on)
DOELSEIF (["$SELF:state: on"] and [19:30]) (set Jalousie8 on; set Jalousie1 on)
DOELSEIF (["$SELF:state: off"]) (set Jalousie[1-8] on)


Aber natürlich funktioniert das nicht, weil der Ablauf nach wahrwerden der ersten Bedingung abbricht.

Es ist sau heiß hier, die Sonne scheint herein und irgendwie habe ich ein Brett vorm Kopf. Wer kann mich mal in die richtige Richtung stupsen?
Wie kann man mit DOIF zeitgesteuerte Sequencen abarbeiten?

Vielen Dank aus dem sonnigen NRW

oelidoc

Hier noch das list:
Internals:
   DEF        (["$SELF:state: on"]) (set Jalousie[3-5] pct 30)
DOELSEIF (["$SELF:state: on"] and [13:30]) (set Jalousie6 pct 30; set Jalousie7 pct 15)
DOELSEIF (["$SELF:state: on"] and [14:30]) (set Jalousie[3-5] on)
DOELSEIF (["$SELF:state: on"] and [17:00]) (set Jalousie8 pct 15; set Jalousie1 pct 30)
DOELSEIF (["$SELF:state: on"] and [18:30]) (set Jalousie[6-7] on)
DOELSEIF (["$SELF:state: on"] and [19:30]) (set Jalousie8 on; set Jalousie1 on)
DOELSEIF (["$SELF:state: off"]) (set Jalousie[1-8] on)
   DOIFDEV    ^global$|beschattung
   FUUID      5c65c109-f33f-74ea-b7fe-80b14acabccc7e5e
   MODEL      FHEM
   NAME       beschattung
   NR         428
   NTFY_ORDER 50-beschattung
   STATE      initialized
   TYPE       DOIF
   VERSION    22428 2020-07-18 20:32:08
   READINGS:
     2020-08-08 18:09:34   cmd             0
     2020-08-08 18:09:34   mode            enabled
     2020-08-08 18:09:34   state           initialized
     2020-08-08 18:09:34   timer_01_c02    09.08.2020 13:30:00
     2020-08-08 18:09:34   timer_02_c03    09.08.2020 14:30:00
     2020-08-08 18:09:34   timer_03_c04    09.08.2020 17:00:00
     2020-08-08 18:09:34   timer_04_c05    08.08.2020 18:30:00
     2020-08-08 18:09:34   timer_05_c06    08.08.2020 19:30:00
   Regex:
     accu:
     cond:
       :
         0:
           "beschattung:state: on" beschattung:state: on
         1:
           "beschattung:state: on" beschattung:state: on
         2:
           "beschattung:state: on" beschattung:state: on
         3:
           "beschattung:state: on" beschattung:state: on
         4:
           "beschattung:state: on" beschattung:state: on
         5:
           "beschattung:state: on" beschattung:state: on
         6:
           "beschattung:state: off" beschattung:state: off
   attr:
     cmdState:
       0:
         on
       1:
         on
       2:
         on
       3:
         on
       4:
         on
       5:
         on
       6:
         on
       7:
         off
   condition:
     0          ::EventDoIf('beschattung',$hash,'state: on',0)
     1          ::EventDoIf('beschattung',$hash,'state: on',0) and ::DOIF_time_once($hash,0,$wday)
     2          ::EventDoIf('beschattung',$hash,'state: on',0) and ::DOIF_time_once($hash,1,$wday)
     3          ::EventDoIf('beschattung',$hash,'state: on',0) and ::DOIF_time_once($hash,2,$wday)
     4          ::EventDoIf('beschattung',$hash,'state: on',0) and ::DOIF_time_once($hash,3,$wday)
     5          ::EventDoIf('beschattung',$hash,'state: on',0) and ::DOIF_time_once($hash,4,$wday)
     6          ::EventDoIf('beschattung',$hash,'state: off',0)
   days:
   devices:
   do:
     0:
       0          set Jalousie[3-5] pct 30
     1:
       0          set Jalousie6 pct 30; set Jalousie7 pct 15
     2:
       0          set Jalousie[3-5] on
     3:
       0          set Jalousie8 pct 15; set Jalousie1 pct 30
     4:
       0          set Jalousie[6-7] on
     5:
       0          set Jalousie8 on; set Jalousie1 on
     6:
       0          set Jalousie[1-8] on
     7:
   helper:
     DEVFILTER  ^global$|beschattung
     NOTIFYDEV  global|.*beschattung.*
     globalinit 1
     last_timer 5
     sleeptimer -1
   intervalfunc:
   localtime:
     0          1596972600
     1          1596976200
     2          1596985200
     3          1596904200
     4          1596907800
   realtime:
     0          13:30:00
     1          14:30:00
     2          17:00:00
     3          18:30:00
     4          19:30:00
   time:
     0          13:30:00
     1          14:30:00
     2          17:00:00
     3          18:30:00
     4          19:30:00
   timeCond:
     0          1
     1          2
     2          3
     3          4
     4          5
   timer:
     0          0
     1          0
     2          0
     3          0
     4          0
   timers:
     1           0
     2           1
     3           2
     4           3
     5           4
   triggertime:
     1596904200:
       localtime  1596904200
       hash:
     1596907800:
       localtime  1596907800
       hash:
     1596972600:
       localtime  1596972600
       hash:
     1596976200:
       localtime  1596976200
       hash:
     1596985200:
       localtime  1596985200
       hash:
   uiState:
   uiTable:
Attributes:
   alexaName  Beschattung
   alias      Beschattung
   cmdState   on|on|on|on|on|on|on|off
   disable    0
   do         always
   eventMap   on:ein off:aus
   genericDeviceType switch
   icon       fts_shutter_70
   readingList state
   room       Jalousien,Mobil,alexaRoom
   setList    on off
   webCmd     ein:aus
Titel: Antw:DOELSEIF Sequence Beschattung
Beitrag von: amenomade am 08 August 2020, 20:02:15
DOELSEIF([13:30] and [?$SELF:state] eq "on")
Aber ich würde ein anderes Reading als state benutzen...

Nur als Denkanstoss: [14:30] ist ein Zeittrigger / Zeitevent.
["$SELF:state: on"] ist auch ein Event.

Zwei Events können nicht gleichzeitig erfolgen. [14:30] and ["$SELF:state: on"] kann nie wahr sein
Titel: Antw:DOELSEIF Sequence Beschattung
Beitrag von: oelidoc am 10 August 2020, 18:34:40
Hallo amenomade,

Vielen Dank. Hab es jetzt mit deiner Hilfe wie folgt ans Laufen bekommen:

([$SELF:state] eq "on") (set Jalousie[3-5] pct 30)
DOELSEIF ([13:30] and [?$SELF:state] eq "on") (set Jalousie6 pct 30; set Jalousie7 pct 15)
DOELSEIF ([15:00] and [?$SELF:state] eq "on") (set Jalousie[3-5] on)
DOELSEIF ([17:00] and [?$SELF:state] eq "on") (set Jalousie8 pct 15; set Jalousie1 pct 25)
DOELSEIF ([18:30] and [?$SELF:state] eq "on") (set Jalousie[6-7] on)
DOELSEIF ([19:30] and [?$SELF:state] eq "on") (set Jalousie8 on; set Jalousie1 on)
DOELSEIF (["$SELF:state: off"])(set Jalousie[1-8] on)


Gruß

oelidoc