Bei Event Einschalten, nur wenn zuvor per DOIF ausgeschaltet wurde

Begonnen von Christian Uhlmann, 19 Oktober 2016, 01:07:59

Vorheriges Thema - Nächstes Thema

Christian Uhlmann

Hallo zusammen,

ich schalte bei mir in der Küche die Lichter über einen dummy (dum.10.EG.ku.WS.LichtKomplett) automatisch nach einiger Zeit (wait 30) aus, wenn kein Bewegung (EG.ku.BMK.Kueche_Motion:motion) erkannt wird.

Das DOIF dazu:

Internals:
   CFGFN
   DEF        ([EG.ku.BMK.Kueche_Motion:motion] eq "off")
(set dum.10.EG.ku.WS.LichtKomplett off)
   NAME       doif.10.EG.ku.WS.LichtKomplett
   NR         1257
   NTFY_ORDER 50-doif.10.EG.ku.WS.LichtKomplett
   STATE      cmd_1
   TYPE       DOIF
   Readings:
     2016-10-19 00:59:45   Device          EG.ku.BMK.Kueche_Motion
     2016-10-19 01:00:15   cmd             1
     2016-10-19 01:00:15   cmd_event       EG.ku.BMK.Kueche_Motion
     2016-10-19 01:00:15   cmd_nr          1
     2016-10-19 00:59:45   e_EG.ku.BMK.Kueche_Motion_motion off
     2016-10-19 01:00:15   state           cmd_1
     2016-10-19 01:00:15   wait_timer      no timer
   Condition:
     0          ReadingValDoIf($hash,'EG.ku.BMK.Kueche_Motion','motion','','',AttrVal($hash->{NAME},'notexist',undef)) eq "off"
   Devices:
     0           EG.ku.BMK.Kueche_Motion
     all         EG.ku.BMK.Kueche_Motion
   Do:
     0:
       0          set dum.10.EG.ku.WS.LichtKomplett off
     1:
   Helper:
     event      reading: off,motion: off,logstate: motion
     globalinit 1
     last_timer 0
     sleepdevice EG.ku.BMK.Kueche_Motion
     sleepsubtimer -1
     sleeptimer -1
     timerdev   EG.ku.BMK.Kueche_Motion
     timerevent reading: off,motion: off,logstate: motion
     triggerDev EG.ku.BMK.Kueche_Motion
     timerevents:
       reading: off
       motion: off
       logstate: motion
     timereventsState:
       reading: off
       motion: off
       logstate: motion
     triggerEvents:
       reading: off
       motion: off
       logstate: motion
     triggerEventsState:
       reading: off
       motion: off
       logstate: motion
   Internals:
   Itimer:
   Readings:
     0           EG.ku.BMK.Kueche_Motion:motion
     all         EG.ku.BMK.Kueche_Motion:motion
   Regexp:
     0:
     All:
   State:
   Trigger:
Attributes:
   wait       30


Das funktioniert auch so, wie ich will.

Jetzt möchte ich gerne, wenn das Licht durch dieses DOIF ausgeschaltet wurde und erneut Bewegung erkannt wird, wieder angeschaltet wird.
Wenn aber jemand das Licht manuell ausgemacht hat, soll es nicht mehr automatisch eingeschaltet werden.

Kann mir jemand nen Tipp geben, wie ich das im sinnvollsten / einfachsten löse?
Geht das ggf. im DOIF und ich finde dafür einfach nur das Beispiel / die Vorlage nicht?


Danke und Grüße

Christian
Host: Debian Buster als VM / XCP-NG
Gateways: DuoFern Stick, CUL433 Revolt, CUL MAX, HMLan, HM-USB 2, LaCrosseGateway
Devices: 12x Rademacher Rollos, 6x TX 29 DT-HT, 10x HM-CC-RT-DN, 14x MAX Fensterkontakte, Diverse HM Aktoren für Licht, Klingel, Gong, Eingangstür, ESPEasy, Sonoff mit Tasmota

Thyraz

Da DOIF ja wie eine State Machine arbeitet, also immer in einem bestimmten Zustand ist, könnte man das ja mit abfragen.

Da ich nicht weiß was für Events von deinem Lichtschalter kommen mal in Pseudo Code:


DOIF ([Lichtschalterevent:"on"])
  (set Licht aus) // Zeitverzögert über wait attribute
DOELSIF ([Motionevent:"motionDetected"] and [$SELF:cmd_nr] == 1 and [Licht:state] eq "off")
  (set Licht an)
DOELSEIF ([Lichtschalterevent:"off"])
  // Hier wird nichts ausgeführt. Dient nur dazu, dass wir nicht mehr in CMD1 hängen und somit durch Bewegung kein Licht mehr angeht
Fhem und MariaDB auf NUC6i5SYH in Proxmox Container (Ubuntu)
Zwave, Conbee II, Hue, Harmony, Solo4k, LaMetric, Echo, Sonos, Roborock S5, Nuki, Prusa Mini, Doorbird, ...

Per

Zitat von: Christian Uhlmann am 19 Oktober 2016, 01:07:59Kann mir jemand nen Tipp geben, wie ich das im sinnvollsten / einfachsten löse?
Ich habe es so gelöst.
Ist seit dem unauffällig im Einsatz.