doif und sunrise_abs schaltet falsch

Begonnen von db7, 12 Mai 2018, 09:47:36

Vorheriges Thema - Nächstes Thema

db7

Guten Morgen, letzte Nacht hat das doif-modul die Beleuchtung im Schlafzimmer um 0:00 eingeschaltet, was neben Licht zu einer Diskussion um den Sinn und Unsinn von Hausautomatisation mit meiner Liebsten geführt hat :-)

Ich verstehe nur nicht warum:

dies ist dei doif-Definition
list di_sz_panel
Internals:
   DEF        ([5:50-{sunrise_abs(0,"5:50","7:15")}|125] and [nw:state] eq 'none')  (set StripLight pct 40 : transitiontime 6000)
DOELSEIF ([6:10-{sunset_abs(180,"6:20","7:30")}|3] and [nw:state] eq 'none' ) (set StripLight pct 50 : transitiontime 4500)
DOELSEIF ([7:25]|12345)(set StripLight off)
DOELSEIF ([sunrise_ms:light] > 5) (set StripLight off)
   NAME       di_sz_panel
   NR         148
   NTFY_ORDER 50-di_sz_panel
   STATE      cmd_4
   TYPE       DOIF
   READINGS:
     2018-05-12 09:25:46   Device          sunrise_ms
     2018-05-12 07:25:46   cmd             4
     2018-05-12 07:25:46   cmd_event       sunrise_ms
     2018-05-12 07:25:46   cmd_nr          4
     2018-05-12 00:00:02   e_nw_state      none
     2018-05-12 09:25:46   e_sunrise_ms_light 6
     2018-05-12 07:25:46   state           cmd_4
     2018-05-12 05:49:59   timer_01_c01    12.05.2018 05:50:00|125
     2018-05-12 05:49:59   timer_02_c01    13.05.2018 05:49:59|125
     2018-05-12 07:30:00   timer_03_c02    13.05.2018 06:10:00|3
     2018-05-12 07:30:00   timer_04_c02    13.05.2018 07:30:00|3
     2018-05-12 07:25:00   timer_05_c03    13.05.2018 07:25:00
   Regex:
   condition:
     0          DOIF_time($hash,0,1,$wday,$hms,"125") and ReadingValDoIf($hash,'nw','state') eq 'none'
     1          DOIF_time($hash,2,3,$wday,$hms,"3") and ReadingValDoIf($hash,'nw','state') eq 'none'
     2          DOIF_time_once($hash,4,$wday)|12345
     3          ReadingValDoIf($hash,'sunrise_ms','light') > 5
   days:
     0          125
     1          125
     2          3
     3          3
   devices:
     0           nw
     1           nw
     3           sunrise_ms
     all         nw sunrise_ms
   do:
     0:
       0          set StripLight pct 40 : transitiontime 6000
     1:
       0          set StripLight pct 50 : transitiontime 4500
     2:
       0          set StripLight off
     3:
       0          set StripLight off
     4:
   helper:
     DOIF_Readings_events
     DOIF_eventas
     event      azimuth: 101.56,elevation: 33.19,twilight: 100,twilight_weather: 100,compasspoint: east
     globalinit 1
     last_timer 5
     sleeptimer -1
     timerdev   sunrise_ms
     timerevent azimuth: 101.56,elevation: 33.19,twilight: 100,twilight_weather: 100,compasspoint: east
     triggerDev sunrise_ms
     timerevents:
       azimuth: 101.56
       elevation: 33.19
       twilight: 100
       twilight_weather: 100
       compasspoint: east
     timereventsState:
       azimuth: 101.56
       elevation: 33.19
       twilight: 100
       twilight_weather: 100
       compasspoint: east
     triggerEvents:
       azimuth: 101.56
       elevation: 33.19
       twilight: 100
       twilight_weather: 100
       compasspoint: east
     triggerEventsState:
       azimuth: 101.56
       elevation: 33.19
       twilight: 100
       twilight_weather: 100
       compasspoint: east
   internals:
   interval:
     0          -1
     1          0
     2          -1
     3          2
   itimer:
   localtime:
     0          1526097000
     1          1526183399
     2          1526184600
     3          1526189400
     4          1526189100
   readings:
     0           nw:state
     1           nw:state
     3           sunrise_ms:light
     all         nw:state sunrise_ms:light
   realtime:
     0          05:50:00
     1          05:49:59
     2          06:10:00
     3          07:30:00
     4          07:25:00
   time:
     0          5:50
     1          {sunrise_abs(0,"5:50","7:15")}
     2          6:10
     3          {sunset_abs(180,"6:20","7:30")}
     4          7:25
   timeCond:
     0          0
     1          0
     2          1
     3          1
     4          2
   timer:
     0          0
     1          0
     2          0
     3          0
     4          0
   timers:
     0           0  1
     1           2  3
     2           4
   trigger:
   triggertime:
     1526183399:
       localtime  1526183399
       hash:
     1526184600:
       localtime  1526184600
       hash:
     1526189100:
       localtime  1526189100
       hash:
     1526189400:
       localtime  1526189400
       hash:
   uiState:
   uiTable:
Attributes:


und das sagt mein doif-log:
2018-05-12_00:00:02 di_sz_panel cmd_nr: 1
2018-05-12_00:00:02 di_sz_panel cmd: 1
2018-05-12_00:00:02 di_sz_panel cmd_event: nw
2018-05-12_00:00:02 di_sz_panel cmd_1


Das Modul nw ist für die Feiertage zuständig:

list nw
Internals:
   HOLIDAYFILE ./FHEM/nw.holiday
   NAME       nw
   NR         156
   READONLY   0
   STATE      none
   TRIGGERTIME 1526162402.484
   TYPE       holiday
   READINGS:
     2018-05-12 00:00:02   state           none
     2018-05-12 00:00:02   tomorrow        none
     2018-05-12 00:00:02   yesterday       none
Attributes:


Frage ich sunrise_abs ab, gibt fhem
fhem> {sunrise_abs(0,"5:50","7:15")}
05:49:59

zurück. Es sollte doch 5:50 sein, oder? Wieso fehlt hier eine Sekunde.

Somit wird aus der doif-Definition
([5:50-{sunrise_abs(0,"5:50","7:15")}|125] and [nw:state] eq 'none')

([5:50-5:49:59|125] and [nw:state] eq 'none')

Gibt es hier ein Problem mit der Zeitangabe, da 5:50 - 5:49:59 eine negative Zeitspanne ergibt?

Wie löst ihr so etwas, das Licht soll von 5:50 bis zum Sonnenaufgang eingeschaltet werden, aber nicht länger als 7:15

Grüße Detlev

Damian

#1
Ganz einfach:

{sunrise_abs(0,"5:50","7:15")} hat wohl 05:49:59 geliefert

Damit ist das erste Zeitintervall 05:50-05:49:59 von 5:50 bis 05:49:59 des nächsten Tages wahr.

Für sunrise_abs bin ich nicht zuständig.

Edit: Wahrscheinlich reicht schon die Angabe: {sunrise_abs(0,"5:51","7:15")}
Programmierte FHEM-Module: DOIF-FHEM, DOIF-Perl, DOIF-uiTable, THRESHOLD, FHEM-Befehl: IF

db7

Danke für die Infos,

habe nicht damit gerechnet, dass der Intervall dann bis in den nächsten Tag hineinreicht.
Kann ich denn zusätzlich auf die Uhrzeit überprüfen? Ich wollte verhindern, dass das Licht für 1 Minute aktiviert wird.

Wie kann ich auf das erreichen einer bestimmten Zeit prüfen?


(sunrise_abs(0,"5:51","7:15") > '5:50') and ...

Gruß Detlev.