Hauptmenü

Klammer Probleme

Begonnen von marko67, 29 Mai 2018, 18:55:02

Vorheriges Thema - Nächstes Thema

marko67

Guten Abend,

ich bekomme es nicht hin, dass meine Beschattung wie gewünscht läuft.

hier mein Code: DOELSEIF ([18:50-20:00] ##4## Abend <25°/Sonne --> Abend_Beschattung
and ($month >= 4 || $month <= 9)
and [Urlaub] eq "Auto"
and [Beschattung_Betriebsart] eq "Auto"
and [MA_033345397506] <=25
and [Rollo_Zustand_OG] eq "Auf_OG"
or [Rollo_Zustand_OG] eq "Zu_OG"
or [Rollo_Zustand_OG] eq "Halb_OG")
(set Rolloscene scene Abend_Beschattung,set PushoverMa msg 'Beschattung' '18-20 Abendbeschattung' ''0'')


Die Rollos fahren immer in die Abend_Beschattung obwohl  [MA_033345397506] <=25 über 30° ist. Wer kann mir den entscheidenten Hinweis geben.

Vielen Dank

Marko

amenomade

and bindet mehr als or.

Was Du geschrieben hast ist gleich :
Zitat(([18:50-20:00]  and ($month >= 4 || $month <= 9)  and [Urlaub] eq "Auto"  and [Beschattung_Betriebsart] eq "Auto"  and [MA_033345397506] <=25  and [Rollo_Zustand_OG] eq "Auf_OG")
or [Rollo_Zustand_OG] eq "Zu_OG"
or [Rollo_Zustand_OG] eq "Halb_OG")

Ausserdem würde ich gerne wissen, was genau MA_033345397506 für Events generiert
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

marko67

Danke für Deine Antwort.  [MA_033345397506] ist ein Thermometer und generiert als Reading:

deviceType MA10200

2018-05-12 10:21:09
humidity 52

2018-05-29 18:43:21
humidityString 52%

2018-05-29 18:43:21
lastRcv 2018-05-29 18:35:24

2018-05-29 18:43:21
state T: 27.8 H: 52

2018-05-29 18:43:21
temperature 27.8

2018-05-29 18:43:21
temperatureString 27.8°C

2018-05-29 18:43:21
triggered 0

2018-05-23 17:29:47

amenomade

#3
Wenn Du aber [MA_033345397506] schreibst, dann ist nur state interessant.
Zitat2018-05-29 18:43:21 state T: 27.8 H: 52

"T: 27.8 H: 52" ist immer < 25
Grund: Perl evaluates any string to 0 if is not a number.

Probier mal eher mit [MA_033345397506:temperature] (und richtig gesetzten Klammern)
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

marko67

Ich habe es wie folgt geändert

DOELSEIF (([19:35-20:00] ##4## Abend <25°/Sonne auf Abend_Beschattung
and ($month >= 4 || $month <= 9)
and [Urlaub] eq "Auto"
and [Beschattung_Betriebsart] eq "Auto"
and [MA_033345397506:temperature] <=25
and [Rollo_Zustand_OG] eq "Auf_OG")
or [Rollo_Zustand_OG] eq "Zu_OG"
or [Rollo_Zustand_OG] eq "Halb_OG")
(set Rolloscene scene Abend_Beschattung,set PushoverMa msg 'Beschattung' '18-20 Abendbeschattung' ''0'')


Punkt 19.35 gingen die Läden hoch obwohl es 27° ist ...

amenomade

Poste mal ein "list" des DOIFs bitte.
Und ein "list MA_033345397506" auch
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

amenomade

#6
Ah, und ich bin mir nicht sicher, dass "($month >= 4 || $month <= 9)" wie erwartet funktioniert.

Ausserdem ist deine Klammersetzung m.A. immer noch falsch. Möchstest Du wirklich z.B., dass Rolloscene auf Abend_Beschattung geht, sobald Rollo_Zustang_OG eq "Zu_OG", unabhängig von dem Rest?
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Damian

Zitat von: amenomade am 29 Mai 2018, 22:37:49
Ah, und ich bin mir nicht sicher, dass "($month >= 4 || $month <= 9)" wie erwartet funktioniert.

Mit Sicherheit nicht: ist immer wahr :)
Programmierte FHEM-Module: DOIF-FHEM, DOIF-Perl, DOIF-uiTable, THRESHOLD, FHEM-Befehl: IF

amenomade

Zitat von: Damian am 29 Mai 2018, 22:40:37
Mit Sicherheit nicht: ist immer wahr :)
Was eigentlich im Moment nicht stört ;) Wird erst in Winter problematisch :P

Die Klammersetzung ist aber entscheidend. Ich vermute, vor 19:35 war Rollo_Zustand_OG entweder auf Zu_OG oder Halb_OG. Um 19:35 wird getriggert, und da ein der beiden letzen "or" wahr ist, ist das ganze wahr und fahren die Rollos nach Befehl
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

marko67

Ich habe weiter versucht und ich bin (hoffentlich) selbst auf den Fehler gestoßen. Ich glaube das hat mich auf einen richtigen Weg gebracht:
"Nein, jede [], die ein Ereignis sendet wird das DOIF triggern. Dann werden die andere bewertet.
Z.B. [wetter_eigheim:windSpeed] wird < 3
oder [tahoma_1026532] wechselt auf "open"
oder 15:59 wird 16:00

Man muss überlegen, ob man wirklich auf allen Ereignisse triggern wird. Wenn einige das DOIF nicht triggern sollten, dann [?condition] statt [condition]"


Hier mein List DOIF:

Internals:
   DEF    ([10:00-12:00] ##1## Morgens 10-12 >25°/Sonne auf Halb_OG
and ($month >= 4 || $month <= 9)
and [?Urlaub] eq "Auto"
and [?Beschattung_Betriebsart] eq "Auto"
and [ESPEasy_KellerMultiSensor:Lux] >=200
and [MA_033345397506:temperature] >=24
and [LaCrosse_28:temperature] >=22
and [?Rollo_Zustand_OG] eq "Auf_OG")
(set Rolloscene scene Rollo_Halb,set Pushover msg 'Beschattung' '10-12 Halb' ''0'')
DOELSEIF ([12:00-18:00] ##2## Mittags 12-18 >25°/Sonne auf Zu_OG
and ($month >= 4 || $month <= 9)
and [?Urlaub] eq "Auto"
and [?Beschattung_Betriebsart] eq "Auto"
and [MA_033345397506:temperature] >=25
and [LaCrosse_28:temperature] >=22
and [?Rollo_Zustand_OG] ne "Zu_OG")
(set Rolloscene scene Rollo_Zu,set Pushover msg 'Beschattung' '12-18 Zu' ''0'')
DOELSEIF ([12:01-18:00] ##3## Mittags Partyraum 12-18 >29°/Sonne auf Halb_EG
and ($month >= 4 || $month <= 9)
and [?Urlaub] eq "Auto"
and [?Beschattung_Betriebsart] eq "Auto"
and [MA_033345397506:temperature] >=30
and [?Rollo_Zustand_EG] eq "Auf_EG")
(set Rollo_Partyraum Halb,set Rollo_Zustand_EG Halb_EG,set Pushover msg 'Beschattung' '12-18 Partyraum Halb' ''0'') 
DOELSEIF (([19:35-20:00] ##4## Abend <25°/Sonne auf Abend_Beschattung
and (($month >= 4 || $month <= 9)
and [?Urlaub] eq "Auto"
and [?Beschattung_Betriebsart] eq "Auto"
and [MA_033345397506:temperature] <=25
and [?Rollo_Zustand_OG] eq "Auf_OG")
or [?Rollo_Zustand_OG] eq "Zu_OG"
or [?Rollo_Zustand_OG] eq "Halb_OG")
(set Rolloscene scene Abend_Beschattung,set Pushover msg 'Beschattung' '18-20 Abendbeschattung' ''0'')
DOELSEIF (([20:00] ##5## Abend nach 20Uhr <25°/Sonne auf Auf
and (($month >= 4 || $month <= 9)
and [?Urlaub] eq "Auto"
and [?Beschattung_Betriebsart] eq "Auto"
and [MA_033345397506:temperature] <=24
and [?Rollo_Zustand_OG] eq "Zu_OG")
or [?Rollo_Zustand_OG] eq "Abend_Beschattung"
or [?Rollo_Zustand_OG] eq "Halb_OG")
(set Rolloscene scene Rollo_Auf,set Pushover msg 'Beschattung' '20 Uhr Auf' ''0'')
DOELSEIF (([12:00-19:54] ##6## Auf bei Wolken
and (($month >= 4 || $month <= 9)
and [?Urlaub] eq "Auto"
and [ESPEasy_KellerMultiSensor:Lux] <=290
and [?MA_033345397506:temperature] <=23
or  [MA_0814dc2e6d65:mmRainActHour] > 0
and [?Rollo_Zustand_OG:stet] eq "Zu_OG")
or [?Rollo_Zustand_OG:state] eq "Abend_Beschattung"
or [?Rollo_Zustand_OG:state] eq "Halb_OG"))
(set Rolloscene scene Rollo_Auf,set Rollo_Partyraum Auf,set Rollo_Zustand_EG Auf_EG,set Beschattung_Betriebsart Hand,set  RollosceneJan  scene Auf,set Pushover msg 'Beschattung' '12-19.54 Auf Wolken' ''0'')
DOELSE ##7##
   MODEL      FHEM
   NAME       Beschattung_doif
   NR         1445
   NTFY_ORDER 50-Beschattung_doif
   STATE      cmd_7
   TYPE       DOIF
   READINGS:
     2018-05-29 23:47:19   Device          LaCrosse_28
     2018-05-29 23:44:59   cmd             7
     2018-05-29 23:44:59   cmd_event       LaCrosse_28
     2018-05-29 23:44:59   cmd_nr          7
     2018-05-29 23:47:19   e_LaCrosse_28_temperature 24
     2018-05-29 23:38:12   mode            enabled
     2018-05-29 23:44:59   state           cmd_7
     2018-05-29 23:38:12   timer_01_c01    30.05.2018 10:00:00
     2018-05-29 23:38:12   timer_02_c01    30.05.2018 12:00:00
     2018-05-29 23:38:12   timer_03_c02    30.05.2018 12:00:00
     2018-05-29 23:38:12   timer_04_c02    30.05.2018 18:00:00
     2018-05-29 23:38:12   timer_05_c03    30.05.2018 12:01:00
     2018-05-29 23:38:12   timer_06_c03    30.05.2018 18:00:00
     2018-05-29 23:38:12   timer_07_c04    30.05.2018 19:35:00
     2018-05-29 23:38:12   timer_08_c04    30.05.2018 20:00:00
     2018-05-29 23:38:12   timer_09_c05    30.05.2018 20:00:00
     2018-05-29 23:38:12   timer_10_c06    30.05.2018 12:00:00
     2018-05-29 23:38:12   timer_11_c06    30.05.2018 19:54:00
     2018-05-29 23:46:32   wait_timer      29.05.2018 23:51:32 cmd_7 LaCrosse_28
   Regex:
   condition:
     0          DOIF_time($hash,0,1,$wday,$hms)   and (($month >= 4 || $month <= 9)  and InternalDoIf($hash,'Urlaub','STATE') eq "Auto"  and InternalDoIf($hash,'Beschattung_Betriebsart','STATE') eq "Auto"  and ReadingValDoIf($hash,'ESPEasy_KellerMultiSensor','Lux') >=200  and ReadingValDoIf($hash,'MA_033345397506','temperature') >=24  and ReadingValDoIf($hash,'LaCrosse_28','temperature') >=22  and InternalDoIf($hash,'Rollo_Zustand_OG','STATE') eq "Auf_OG")
     1          DOIF_time($hash,2,3,$wday,$hms)   and (($month >= 4 || $month <= 9)  and InternalDoIf($hash,'Urlaub','STATE') eq "Auto"  and InternalDoIf($hash,'Beschattung_Betriebsart','STATE') eq "Auto"  and ReadingValDoIf($hash,'MA_033345397506','temperature') >=25  and ReadingValDoIf($hash,'LaCrosse_28','temperature') >=22  and InternalDoIf($hash,'Rollo_Zustand_OG','STATE') ne "Zu_OG")
     2          DOIF_time($hash,4,5,$wday,$hms)   and (($month >= 4 || $month <= 9)  and InternalDoIf($hash,'Urlaub','STATE') eq "Auto"  and InternalDoIf($hash,'Beschattung_Betriebsart','STATE') eq "Auto"  and ReadingValDoIf($hash,'MA_033345397506','temperature') >=30  and InternalDoIf($hash,'Rollo_Zustand_EG','STATE') eq "Auf_EG")
     3          (DOIF_time($hash,6,7,$wday,$hms)   and ($month >= 4 || $month <= 9)  and InternalDoIf($hash,'Urlaub','STATE') eq "Auto"  and InternalDoIf($hash,'Beschattung_Betriebsart','STATE') eq "Auto"  and ReadingValDoIf($hash,'MA_033345397506','temperature') <=25  and InternalDoIf($hash,'Rollo_Zustand_OG','STATE') eq "Auf_OG")  or InternalDoIf($hash,'Rollo_Zustand_OG','STATE') eq "Zu_OG"  or InternalDoIf($hash,'Rollo_Zustand_OG','STATE') eq "Halb_OG"
     4          DOIF_time_once($hash,8,$wday)   and ($month >= 4 || $month <= 9)  and InternalDoIf($hash,'Urlaub','STATE') eq "Auto"  and InternalDoIf($hash,'Beschattung_Betriebsart','STATE') eq "Auto"  and ReadingValDoIf($hash,'MA_033345397506','temperature') <=24  and InternalDoIf($hash,'Rollo_Zustand_OG','STATE') eq "Zu_OG"  or InternalDoIf($hash,'Rollo_Zustand_OG','STATE') eq "Abend_Beschattung"  or InternalDoIf($hash,'Rollo_Zustand_OG','STATE') eq "Halb_OG"
     5          DOIF_time($hash,9,10,$wday,$hms)   and ($month >= 4 || $month <= 9)  and InternalDoIf($hash,'Urlaub','STATE') eq "Auto"  and ReadingValDoIf($hash,'ESPEasy_KellerMultiSensor','Lux') <=290  and ReadingValDoIf($hash,'MA_033345397506','temperature') <=23  or  ReadingValDoIf($hash,'MA_0814dc2e6d65','mmRainActHour') > 0  and ReadingValDoIf($hash,'Rollo_Zustand_OG','stet') eq "Zu_OG"  or ReadingValDoIf($hash,'Rollo_Zustand_OG','state') eq "Abend_Beschattung"  or ReadingValDoIf($hash,'Rollo_Zustand_OG','state') eq "Halb_OG"
   days:
   devices:
     0           ESPEasy_KellerMultiSensor MA_033345397506 LaCrosse_28
     1           MA_033345397506 LaCrosse_28
     2           MA_033345397506
     3           MA_033345397506
     4           MA_033345397506
     5           ESPEasy_KellerMultiSensor MA_0814dc2e6d65
     all         ESPEasy_KellerMultiSensor MA_033345397506 LaCrosse_28 MA_0814dc2e6d65
   do:
     0:
       0          set Rolloscene scene Rollo_Halb,set PushoverDirk msg 'Beschattung' '10-12 Halb' ''0''
     1:
       0          set Rolloscene scene Rollo_Zu,set PushoverDirk msg 'Beschattung' '12-18 Zu' ''0''
     2:
       0          set Rollo_Partyraum Halb,set Rollo_Zustand_EG Halb_EG,set PushoverDirk msg 'Beschattung' '12-18 Partyraum Halb' ''0''
     3:
       0          set Rolloscene scene Abend_Beschattung,set PushoverDirk msg 'Beschattung' '18-20 Abendbeschattung' ''0''
     4:
       0          set Rolloscene scene Rollo_Auf,set PushoverDirk msg 'Beschattung' '20 Uhr Auf' ''0''
     5:
       0          set Rolloscene scene Rollo_Auf,set Rollo_Partyraum Auf,set Rollo_Zustand_EG Auf_EG,set Beschattung_Betriebsart Hand,set  RollosceneJan  scene Auf,set PushoverDirk msg 'Beschattung' '12-19.54 Auf Wolken' ''0''
     6:
       0         
   helper:
     DOIF_Readings_events
     DOIF_eventas
     event      temperature: 24
     globalinit 1
     last_timer 11
     sleepdevice LaCrosse_28
     sleepsubtimer 0
     sleeptimer 6
     timerdev   LaCrosse_28
     timerevent temperature: 24
     triggerDev LaCrosse_28
     timerevents:
       temperature: 24
     timereventsState:
       temperature: 24
     triggerEvents:
       temperature: 24
     triggerEventsState:
       temperature: 24
   internals:
     0           Urlaub:STATE Beschattung_Betriebsart:STATE Rollo_Zustand_OG:STATE
     1           Urlaub:STATE Beschattung_Betriebsart:STATE Rollo_Zustand_OG:STATE
     2           Urlaub:STATE Beschattung_Betriebsart:STATE Rollo_Zustand_EG:STATE
     3           Urlaub:STATE Beschattung_Betriebsart:STATE Rollo_Zustand_OG:STATE
     4           Urlaub:STATE Beschattung_Betriebsart:STATE Rollo_Zustand_OG:STATE
     5           Urlaub:STATE
     all         Urlaub:STATE Beschattung_Betriebsart:STATE Rollo_Zustand_OG:STATE Rollo_Zustand_EG:STATE
   interval:
     0          -1
     1          0
     10         9
     2          -1
     3          2
     4          -1
     5          4
     6          -1
     7          6
     9          -1
   intervalfunc:
   itimer:
   localtime:
     0          1527667200
     1          1527674400
     10         1527702840
     2          1527674400
     3          1527696000
     4          1527674460
     5          1527696000
     6          1527701700
     7          1527703200
     8          1527703200
     9          1527674400
   readings:
     0           ESPEasy_KellerMultiSensor:Lux MA_033345397506:temperature LaCrosse_28:temperature
     1           MA_033345397506:temperature LaCrosse_28:temperature
     2           MA_033345397506:temperature
     3           MA_033345397506:temperature
     4           MA_033345397506:temperature
     5           ESPEasy_KellerMultiSensor:Lux MA_0814dc2e6d65:mmRainActHour
     all         ESPEasy_KellerMultiSensor:Lux MA_033345397506:temperature LaCrosse_28:temperature MA_0814dc2e6d65:mmRainActHour
   realtime:
     0          10:00:00
     1          12:00:00
     10         19:54:00
     2          12:00:00
     3          18:00:00
     4          12:01:00
     5          18:00:00
     6          19:35:00
     7          20:00:00
     8          20:00:00
     9          12:00:00
   time:
     0          10:00:00
     1          12:00:00
     10         19:54:00
     2          12:00:00
     3          18:00:00
     4          12:01:00
     5          18:00:00
     6          19:35:00
     7          20:00:00
     8          20:00:00
     9          12:00:00
   timeCond:
     0          0
     1          0
     10         5
     2          1
     3          1
     4          2
     5          2
     6          3
     7          3
     8          4
     9          5
   timer:
     0          0
     1          0
     10         0
     2          0
     3          0
     4          0
     5          0
     6          0
     7          0
     8          0
     9          0
   timers:
     0           0  1
     1           2  3
     2           4  5
     3           6  7
     4           8
     5           9  10
   trigger:
   triggertime:
     1527667200:
       localtime  1527667200
       hash:
     1527674400:
       localtime  1527674400
       hash:
     1527674460:
       localtime  1527674460
       hash:
     1527696000:
       localtime  1527696000
       hash:
     1527701700:
       localtime  1527701700
       hash:
     1527702840:
       localtime  1527702840
       hash:
     1527703200:
       localtime  1527703200
       hash:
   uiState:
   uiTable:
Attributes:
   disable    0
   do         always
   icon       helper_doif
   room       Test
   wait       300:300:300:300:300:300:300


und hier der Tempsensor:

Internals:
   DEF        033345397506
   DeviceID   033345397506
   LASTInputDev MobileAlertsGW
   MSGCNT     602
   MobileAlertsGW_MSGCNT 602
   MobileAlertsGW_TIME 2018-05-29 23:34:59
   NAME       MA_033345397506
   NR         1408
   STATE      <b><div style='color:red'>Temp.Hof: 21.6°C <br/><div style='color:yellow'>Luftfeuchte: 68%</div>
   TYPE       MOBILEALERTS
   OLDREADINGS:
   READINGS:
     2018-05-12 10:36:42   actStatus       switchedOff
     2018-05-12 10:21:09   deviceType      MA10200
     2018-05-29 23:16:45   humidity        68
     2018-05-29 23:16:45   humidityString  68%
     2018-05-29 23:30:48   lastRcv         2018-05-29 23:30:48
     2018-05-29 23:30:48   state           T: 21.6 H: 68
     2018-05-29 23:30:48   temperature     21.6
     2018-05-29 23:30:48   temperatureString 21.6°C
     2018-05-23 17:29:47   triggered       0
     2018-05-29 23:30:48   txCounter       4195
Attributes:
   alias      Temp_Hof
   event-on-change-reading .*
   group      MOBILEALERTS,Temperatur
   icon       temp_outside
   room       LaCrosse,MOBILEALERTS,Wetter
   stateFormat <b><div style='color:red'>Temp.Hof: temperature°C <br/><div style='color:yellow'>Luftfeuchte: humidity%</div>
   timestamp-on-change-reading .*


Danke für Eure Unterstützung/Hilfe.Bitte schaut Euch den Code mal an und natürlich bin ich offen für jede Verbesserung.. auch was den Zeitraum (Monate) angeht.

Marko


nils_

Zitat von: marko67 am 30 Mai 2018, 00:05:41
Bitte schaut Euch den Code mal an und natürlich bin ich offen für jede Verbesserung.. auch was den Zeitraum (Monate) angeht.

so wie es jetzt ist - mit || - kannst du es auch direkt weglassen, weil wie Damian schon gesagt hat, ist es immer wahr.

du willst aber vermutlich nur im frühling/sommer etwas durchführen.
d.h. der aktuelle monat muß größer als April _UND_ kleiner als September
viele Wege in FHEM es gibt!

holle75

ich habe an einer Stelle
... and ($month >= [BeregnungStartmonat] and $month <= [BeregnungEndmonat])

Die Dummies sind mit 1-12 für den jeweiligen Monat befüllt.