[GELÖST] Problem mit DOIF Steuerung über Zeitraum

Begonnen von Invers, 13 November 2017, 19:50:39

Vorheriges Thema - Nächstes Thema

Invers

Ich habe ein DOIF, welches eigentlich auch (fast) genau tut, was ich möchte.
Es soll zwischen 07:01 und 00:59 alle 5 Minuten  geprüft werden, ob sich ein Wert verändert hat.
Damit wird geprüft, ob mein Pi-Radio noch arbeitet. Ändert sich der Titel, ist alles ok, sonst klemmt etwas und cmd_1 soll ausgeführt werden.
Ansonsten ist alles ok, cmd_2 soll ausgeführt werden.
Da ich aber nachts das Pi-Radio stoppe, ändert sich der Wert nie. Ist ja auch logisch. Also soll auch nicht cmd_2 ausgeführt werden, was sonst zu Perl-Meldungen im Log führen würde.
Nun habe ich versucht, diesen Zeitraum ebenfalls in cmd_2 einzufügen. Das läuft aber nicht. Weder mit do allways, noch sonst irgendwie.

Mein laufende DOIF:
defmod DI_Webradio_watchdog2 DOIF ([+300] and [07:01-00:59] and [?Webradio:Title] eq [$SELF:Titel]) (set Webradio playfile [DU_ZV:SenderURL], {Log 3,("▀ Webradio URL geschickt")})\
DOELSE (setreading $SELF Titel [Webradio:Title])\

attr DI_Webradio_watchdog2 disable 0
attr DI_Webradio_watchdog2 do always
attr DI_Webradio_watchdog2 room Bad


Mein geändertes DOIF, was nicht läuft:

defmod DI_Webradio_watchdog2 DOIF ([+300] and [07:01-00:59] and [?Webradio:Title] eq [$SELF:Titel]) (set Webradio playfile [DU_ZV:SenderURL], {Log 3,("▀ Webradio URL geschickt")})\
DOELSEIF ([07:01-00:59]) (setreading $SELF Titel [Webradio:Title])\

attr DI_Webradio_watchdog2 disable 0
attr DI_Webradio_watchdog2 do always
attr DI_Webradio_watchdog2 room Bad


Geht da mit dem 2. Zeitraum im DOELSEIF vielleicht gar nicht?


Danke im Voraus für Antworten.
Pi3B+ mit SSD/ Bullseye | FB7590 AX | 12 x Dect200 | CUL433+868 | SDuino | HM-LAN | 3 x Heizung FHT + FKontakte | KeyMatic + 4 FB | HM Wandtaster 2-fach m. LED | 6 x Türkont. TFK-TI | HM-Bew.-Melder innen | 3 x Smoked. HM-SEC-SD-2

amenomade

Ich würdeDOELSEIF ([07:01-00:59] and [Webradio:Title] ne [$SELF:Titel])schreiben
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Invers

Das ist eine gute Idee, die ich aber leider auch schon hatte. Das führt ebenfalls nicht zum Erfolg. Cmd2 wird auch da niemals ausgeführt. Aber trotzdem erst einmal danke schön.
Pi3B+ mit SSD/ Bullseye | FB7590 AX | 12 x Dect200 | CUL433+868 | SDuino | HM-LAN | 3 x Heizung FHT + FKontakte | KeyMatic + 4 FB | HM Wandtaster 2-fach m. LED | 6 x Türkont. TFK-TI | HM-Bew.-Melder innen | 3 x Smoked. HM-SEC-SD-2

Otto123

#3
Musst Du nicht einfach die Zeit andersherum nehmen? also 00:59 - 07:01 ?
Du willst doch cmd_2 nachts nicht ausführen? Oder habe ich das falsch verstanden? Ansonsten solltest Du über eine dritte Bedingung nachdenken.
Die Zeit ist doch dominierend in Deiner Abfrage...

Gruß Otto
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

amenomade

Zitat von: Invers am 13 November 2017, 21:09:54
Das ist eine gute Idee, die ich aber leider auch schon hatte. Das führt ebenfalls nicht zum Erfolg. Cmd2 wird auch da niemals ausgeführt. Aber trotzdem erst einmal danke schön.

Hast Du wirklich das probiert?
DOELSEIF ([07:01-00:59] and [Webradio:Title] ne [$SELF:Titel])
oder eher das?
DOELSEIF ([07:01-00:59] and [?Webradio:Title] ne [$SELF:Titel])
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Invers

#5
@Otto
Nein, so ist es gewollt. Nachts soll nicht ausgewertet werden.

@amenomade
Ja, toll! Ich bin vielleicht ein Trottel. Natürlich hast dur Recht.
Meit deinem Konstrukt wird also tatsächlich der cmd_2 ausagefhrt, aber die Sache läuft trotzdem falsch, weil die 5 Minuten triggern sollen, nicht das Reading. Daher ist das ? wichtig.
Ich weiss also inmmer noch nicht, wie ich mein DOIF nachts zum Schweigen bringen soll. 
Ich versuche mal:
DOELSEIF ([+300] and [07:01-00:59] and [?Webradio:Title] ne [$SELF:Titel]) (setreading $SELF Titel [Webradio:Title])


Wenn die +300 Timer einigermassen synchron laufen, wäre ja alles ok.
Danke, dass du so gut aufgepasst hast. Das wäre mir so schnell nicht aufgefallen.


EDIT:

so scheint es zu funktionieren, die Timer sind tatsächlich identisch. Hier mal zur Info ein List.
Werde ich mal bis morgen beobachten.

Internals:
   CFGFN
   DEF        ([+300] and [07:01-00:59] and [?Webradio:Title] eq [$SELF:Titel]) (set Webradio playfile [DU_ZV:SenderURL], {Log 3,("▀ Webradio URL geschickt")})
DOELSEIF ([+300] and [07:01-00:59] and [?Webradio:Title] ne [$SELF:Titel]) (setreading $SELF Titel [Webradio:Title])
##DOELSE (setreading $SELF Titel [Webradio:Title])

   NAME       DI_Webradio_watchdog2
   NR         466
   NTFY_ORDER 50-DI_Webradio_watchdog2
   STATE      cmd_2
   TYPE       DOIF
   READINGS:
     2017-11-13 22:30:37   Titel           SUNDOWN
     2017-11-13 22:30:37   cmd             2
     2017-11-13 22:30:37   cmd_event       timer_4
     2017-11-13 22:30:37   cmd_nr          2
     2017-11-13 22:30:37   state           cmd_2
     2017-11-13 22:30:37   timer_01_c01    13.11.2017 22:35:37
     2017-11-13 22:25:37   timer_02_c01    14.11.2017 07:01:00
     2017-11-13 22:25:37   timer_03_c01    14.11.2017 00:59:00
     2017-11-13 22:30:37   timer_04_c02    13.11.2017 22:35:37
     2017-11-13 22:25:37   timer_05_c02    14.11.2017 07:01:00
     2017-11-13 22:25:37   timer_06_c02    14.11.2017 00:59:00
   Regex:
     myReadings:
     uiTable:
   condition:
     0          DOIF_time_once($hash,0,$wday) and DOIF_time($hash,1,2,$wday,$hms) and ReadingValDoIf($hash,'Webradio','Title') eq ReadingValDoIf($hash,'DI_Webradio_watchdog2','Titel')
     1          DOIF_time_once($hash,3,$wday) and DOIF_time($hash,4,5,$wday,$hms) and ReadingValDoIf($hash,'Webradio','Title') ne ReadingValDoIf($hash,'DI_Webradio_watchdog2','Titel')
   days:
   devices:
     0           DI_Webradio_watchdog2
     1           DI_Webradio_watchdog2
     all         DI_Webradio_watchdog2
   do:
     0:
       0          set Webradio playfile [DU_ZV:SenderURL], {Log 3,("▀ Webradio URL geschickt")}
     1:
       0          setreading DI_Webradio_watchdog2 Titel [Webradio:Title]
     2:
   helper:
     event      timer_4
     globalinit 1
     last_timer 6
     sleeptimer -1
     timerdev
     timerevent timer_4
     timereventsState
     triggerDev
     timerevents:
       timer_4
     triggerEvents:
       timer_4
   internals:
   interval:
     1          -1
     2          1
     4          -1
     5          4
   itimer:
   localtime:
     0          1510608937
     1          1510639260
     2          1510617540
     3          1510608937
     4          1510639260
     5          1510617540
   readings:
     0           DI_Webradio_watchdog2:Titel
     1           DI_Webradio_watchdog2:Titel
     all         DI_Webradio_watchdog2:Titel
   realtime:
     0          22:35:37
     1          07:01:00
     2          00:59:00
     3          22:35:37
     4          07:01:00
     5          00:59:00
   time:
     0          +300
     1          07:01:00
     2          00:59:00
     3          +300
     4          07:01:00
     5          00:59:00
   timeCond:
     0          0
     1          0
     2          0
     3          1
     4          1
     5          1
   timer:
     0          0
     1          0
     2          0
     3          0
     4          0
     5          0
   timers:
     0           0  1  2
     1           3  4  5
   triggertime:
     1510608937:
       localtime  1510608937
       hash:
     1510617540:
       localtime  1510617540
       hash:
     1510639260:
       localtime  1510639260
       hash:
   uitable:
Attributes:
   disable    0
   do         always
   room       Bad
Pi3B+ mit SSD/ Bullseye | FB7590 AX | 12 x Dect200 | CUL433+868 | SDuino | HM-LAN | 3 x Heizung FHT + FKontakte | KeyMatic + 4 FB | HM Wandtaster 2-fach m. LED | 6 x Türkont. TFK-TI | HM-Bew.-Melder innen | 3 x Smoked. HM-SEC-SD-2

amenomade

Ansonsten, wenn deine ganz erste Variante funktioniert: ([+300] and [07:01-00:59] and [?Webradio:Title] eq [$SELF:Titel])
    (set Webradio playfile [DU_ZV:SenderURL], {Log 3,("▀ Webradio URL geschickt")})
DOELSE
   (setreading $SELF Titel [Webradio:Title])
dann baue einfach ein IF im 2. Zweig:
defmod DI_Webradio_watchdog2 DOIF ([+300] and [07:01-00:59] and [?Webradio:Title] eq [$SELF:Titel]) (set Webradio playfile [DU_ZV:SenderURL], {Log 3,("▀ Webradio URL geschickt")})\
DOELSE (IF ($hms gt "07:00" or $hms lt "01:00" ) (setreading $SELF Titel [Webradio:Title]))
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Invers

Mein zuletzt dargestelltes Konstrukt funktioniert.
Ich danke dir für Hilfe und Tipps.
Pi3B+ mit SSD/ Bullseye | FB7590 AX | 12 x Dect200 | CUL433+868 | SDuino | HM-LAN | 3 x Heizung FHT + FKontakte | KeyMatic + 4 FB | HM Wandtaster 2-fach m. LED | 6 x Türkont. TFK-TI | HM-Bew.-Melder innen | 3 x Smoked. HM-SEC-SD-2

Per

Auch wenn es jetzt erledigt ist: warum machst du nicht einfach ein Watchdog mit resetwait?
[07:01-00:59] and [Webradio:Title] ne [$SELF:Titel])
    (setreading $SELF Titel [Webradio:Title])
    (set Webradio playfile [DU_ZV:SenderURL], {Log 3,("▀ Webradio URL geschickt")})
DOELSE

attr xx wait 0,300:0
attr xx do resetwait


Invers

Das hatte ich versucht, hatte aber den Nebeneffekt, dass es nicht funktionierte, wenn Das Senden der URL einmal fehlgeschlagen war. Dann hatte ich keinen Timer mehr.
Ausserdem sollte sich ja die URL nur ändern, wenn der Titel nach 5 Minuten unverändert blieb.
Pi3B+ mit SSD/ Bullseye | FB7590 AX | 12 x Dect200 | CUL433+868 | SDuino | HM-LAN | 3 x Heizung FHT + FKontakte | KeyMatic + 4 FB | HM Wandtaster 2-fach m. LED | 6 x Türkont. TFK-TI | HM-Bew.-Melder innen | 3 x Smoked. HM-SEC-SD-2

Per

Zitat von: Invers am 15 November 2017, 17:53:01
Das hatte ich versucht, hatte aber den Nebeneffekt, dass es nicht funktionierte, wenn Das Senden der URL einmal fehlgeschlagen war. Dann hatte ich keinen Timer mehr.
Stimmt, das kann man aber mit
(set Webradio playfile [DU_ZV:SenderURL], {Log 3,("▀ Webradio URL geschickt")},set $SELF cmd_1)
erzwingen.

Zitat von: Invers am 15 November 2017, 17:53:01Ausserdem sollte sich ja die URL nur ändern, wenn der Titel nach 5 Minuten unverändert blieb.
Macht es doch?!