DOIF Vereinfachung (Parametrisierung) - was könnte ich wohl verbessern...?

Begonnen von Morgennebel, 23 August 2018, 12:13:19

Vorheriges Thema - Nächstes Thema

Morgennebel

Moin, Moin,


ich möchte meine Außenbeleuchtung zeitgesteuert und mit Bewegungsmeldern steuern. Alle Außenlampen sind Philips HUE dimmbare LEDs.
Es wird 6-7 Bewegungsmelder um das ganze Haus herum geben.

Folgende Ideen:


  • Morgens 05:30 oder 06:30 bis Sonnenaufgang Standardbeleuchtung 50% gedimmt
  • Abends bis 21:30 oder 22:45 (in Abhängigkeit ob morgen Ferien, Sa oder So ist) Standardbeleuchtung 50% gedimmt
  • Bei Bewegung bei Standardbeleuchtung sollen die entsprechenden Lampen auf 100% aufdimmen und danach wieder abdimmen (während der Standardbeleuchtung) oder aus (außerhalb der Standardbeleuchtung) sein
  • Der Weg vom Carport zur Eingangstür führt an 3-4 Bewegungsmeldern vorbei

Mein Lösungsansatz bisher sind:


  • Lightscenes für die Grundbeleuchtung und aufgedimmte Lampen (d.h. ca. 10 Szenen)
  • DOIF-Bedingung für die Standardbeleuchtung morgens und abends mit sunset() und sunrise() und einer Lightscene
  • DOELSEIF-Bedingungen für das Ansprechen eines Bewegungsmelders und aufdimmen mit je einer Lightscene
  • DOIF-Reading zur Berechnung des abendlichen Ausschaltpunktes (auf Basis des Kalendermoduls)

Das sieht derzeit so aus:


Internals:
   CFGFN     
   DEF        ([{sunset_abs(-900)}-[$SELF:OffNight]] or [06:30-{sunrise_abs()}|7] or [05:30-{sunrise_abs()}|8])
(set LS_AussenNachtbeleuchtung scene StandardDimmed)
DOELSEIF ([{sunset_abs(-900)}-{sunrise_abs()}] and [HM_AUSSEN_MOTION.CarPort1] eq "motion" and [HM_AUSSEN_MOTION.Eingang] ne "motion")
(set LS_AussenNachtbeleuchtung scene BrightCarport)
DOELSEIF ([{sunset_abs(-900)}-{sunrise_abs()}] and [HM_AUSSEN_MOTION.CarPort1] ne "motion" and [HM_AUSSEN_MOTION.Eingang] eq "motion")
(set LS_AussenNachtbeleuchtung scene BrightDoor)
DOELSEIF ([{sunset_abs(-900)}-{sunrise_abs()}] and [HM_AUSSEN_MOTION.CarPort1] eq "motion" and [HM_AUSSEN_MOTION.Eingang] eq "motion")
(set LS_AussenNachtbeleuchtung scene AllOn)
DOELSE
(set LS_AussenNachtbeleuchtung scene AllOff)

   NAME       DI_TimerAussenlichtOnOff
   NR         199
   NTFY_ORDER 50-DI_TimerAussenlichtOnOff
   STATE      cmd_5
   TYPE       DOIF
   DOIF_Readings:
     MySunRise  ({sunrise_abs()})
     MySunSet   ({sunset_abs(-900)})
     OffNight   (ReadingValDoIf($hash,'SH','tomorrow') ne "none" ? "22:30:00" : "21:45:00")
   OLDREADINGS:
   READINGS:
     2018-08-20 00:00:03   OffNight        21:45:00
     2018-08-23 05:32:45   cmd             5
     2018-08-23 05:32:45   cmd_event       timer_12
     2018-08-23 05:32:45   cmd_nr          5
     2018-08-21 11:52:43   mode            enabled
     2018-08-23 05:32:45   state           cmd_5
     2018-08-22 21:45:00   timer_01_c01    23.08.2018 21:04:30
     2018-08-22 21:45:00   timer_02_c01    23.08.2018 21:45:00
     2018-08-23 05:34:46   timer_03_c01    23.08.2018 06:30:00|7
     2018-08-23 05:34:46   timer_04_c01    24.08.2018 05:34:46|7
     2018-08-23 05:34:46   timer_05_c01    24.08.2018 05:30:00|8
     2018-08-23 05:34:46   timer_06_c01    24.08.2018 05:34:46|8
     2018-08-23 05:34:46   timer_07_c02    23.08.2018 21:01:58
     2018-08-23 05:34:46   timer_08_c02    24.08.2018 05:34:46
     2018-08-23 05:34:46   timer_09_c03    23.08.2018 21:01:58
     2018-08-23 05:34:46   timer_10_c03    24.08.2018 05:34:46
     2018-08-23 05:34:46   timer_11_c04    23.08.2018 21:01:58
     2018-08-23 05:34:46   timer_12_c04    24.08.2018 05:34:46
   Regex:
     DOIF_Readings:
       SH:
         OffNight:
           tomorrow   ^SH$:^tomorrow:
   condition:
     0          DOIF_time($hash,0,1,$wday,$hms) or DOIF_time($hash,2,3,$wday,$hms,"7") or DOIF_time($hash,4,5,$wday,$hms,"8")
     1          DOIF_time($hash,6,7,$wday,$hms) and InternalDoIf($hash,'HM_AUSSEN_MOTION.CarPort1','STATE') eq "motion" and InternalDoIf($hash,'HM_AUSSEN_MOTION.Eingang','STATE') ne "motion"
     2          DOIF_time($hash,8,9,$wday,$hms) and InternalDoIf($hash,'HM_AUSSEN_MOTION.CarPort1','STATE') ne "motion" and InternalDoIf($hash,'HM_AUSSEN_MOTION.Eingang','STATE') eq "motion"
     3          DOIF_time($hash,10,11,$wday,$hms) and InternalDoIf($hash,'HM_AUSSEN_MOTION.CarPort1','STATE') eq "motion" and InternalDoIf($hash,'HM_AUSSEN_MOTION.Eingang','STATE') eq "motion"
   days:
     2          7
     3          7
     4          8
     5          8
   devices:
     1           HM_AUSSEN_MOTION.CarPort1 HM_AUSSEN_MOTION.Eingang
     2           HM_AUSSEN_MOTION.CarPort1 HM_AUSSEN_MOTION.Eingang
     3           HM_AUSSEN_MOTION.CarPort1 HM_AUSSEN_MOTION.Eingang
     all         HM_AUSSEN_MOTION.CarPort1 HM_AUSSEN_MOTION.Eingang
   do:
     0:
       0          set LS_AussenNachtbeleuchtung scene StandardDimmed
     1:
       0          set LS_AussenNachtbeleuchtung scene BrightCarport
     2:
       0          set LS_AussenNachtbeleuchtung scene BrightDoor
     3:
       0          set LS_AussenNachtbeleuchtung scene AllOn
     4:
       0          set LS_AussenNachtbeleuchtung scene AllOff
   helper:
     DOIF_Readings_events
     DOIF_eventas
     event      timer_12
     globalinit 1
     last_timer 12
     sleeptimer -1
     timerdev   
     timerevent timer_12
     timereventsState
     triggerDev
     timerevents:
       timer_12
     triggerEvents:
       timer_12
   internals:
     1           HM_AUSSEN_MOTION.CarPort1:STATE HM_AUSSEN_MOTION.Eingang:STATE
     2           HM_AUSSEN_MOTION.CarPort1:STATE HM_AUSSEN_MOTION.Eingang:STATE
     3           HM_AUSSEN_MOTION.CarPort1:STATE HM_AUSSEN_MOTION.Eingang:STATE
     all         HM_AUSSEN_MOTION.CarPort1:STATE HM_AUSSEN_MOTION.Eingang:STATE
   interval:
     0          -1
     1          0
     10         -1
     11         10
     2          -1
     3          2
     4          -1
     5          4
     6          -1
     7          6
     8          -1
     9          8
   itimer:
     all         DI_TimerAussenlichtOnOff
   localtime:
     0          1535051070
     1          1535053500
     10         1535050918
     11         1535081686
     2          1534998600
     3          1535081686
     4          1535081400
     5          1535081686
     6          1535050918
     7          1535081686
     8          1535050918
     9          1535081686
   readings:
   realtime:
     0          21:04:30
     1          21:45:00
     10         21:01:58
     11         05:34:46
     2          06:30:00
     3          05:34:46
     4          05:30:00
     5          05:34:46
     6          21:01:58
     7          05:34:46
     8          21:01:58
     9          05:34:46
   time:
     0          {sunset_abs(-900)}
     1          [DI_TimerAussenlichtOnOff:OffNight]
     10         {sunset_abs(-900)}
     11         {sunrise_abs()}
     2          06:30:00
     3          {sunrise_abs()}
     4          05:30:00
     5          {sunrise_abs()}
     6          {sunset_abs(-900)}
     7          {sunrise_abs()}
     8          {sunset_abs(-900)}
     9          {sunrise_abs()}
   timeCond:
     0          0
     1          0
     10         3
     11         3
     2          0
     3          0
     4          0
     5          0
     6          1
     7          1
     8          2
     9          2
   timer:
     0          0
     1          0
     10         0
     11         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
     1           6  7
     2           8  9
     3           10  11
   triggertime:
     1535050918:
       localtime  1535050918
       hash:
     1535051070:
       localtime  1535051070
       hash:
     1535053500:
       localtime  1535053500
       hash:
     1535081400:
       localtime  1535081400
       hash:
     1535081686:
       localtime  1535081686
       hash:
   uiState:
   uiTable:
Attributes:
   DOIF_Readings OffNight:([SH:tomorrow] ne "none" ? "22:30:00" : "21:45:00"), MySunRise:({sunrise_abs()}), MySunSet:({sunset_abs(-900)})
   room       Aussen,SYS_Events


Diese Lösung hat derzeit zwei Bewegungsmeldern. Mit 5-7 Stück wird das ganze etwas... kompliziert häßlich.

Läßt sich das ganze irgendwie geschickter mit Filtern und/oder Parametern vereinfachen...?

Danke, -MN
Einziger Spender an FHEM e.V. mit Dauerauftrag seit >= 24 Monaten

FHEM: MacMini/ESXi, 2-3 FHEM Instanzen produktiv
In-Use: STELLMOTOR, VALVES, PWM-PWMR, Xiaomi, Allergy, Proplanta, UWZ, MQTT,  Homematic, Luftsensor.info, ESP8266, ESERA

Per

Du könntest Melder und Szenen mit korrespondierenden Namen versehen.
Zum Beispiel "Scene_1_2" für eine, die auf Melder 1 und 2 reagiert. Dann kannst du die Namen der Szene einfach erstellen (Aggregation) und ausführen.