Beschattungssteuerung mit DOIF

Begonnen von stephan20, 25 Juni 2020, 23:49:03

Vorheriges Thema - Nächstes Thema

stephan20

Hallo FHEM Community.

Ich versuche seit einiger Zeit die Beschattung meiner Wohnung mit einem DOIF zu realisieren. Offensichtlich habe ich aber in meinem Code einen Fehler, den ich partout nicht finden kann. Das DOIF führt komischerweise immer nur CMD3 aus, obwohl die anderen Bedingungen alle stimmen.
Mag vielleicht jemand einmal drüber schauen?

(([Wettersensor2:BME280_Temperatur]>24 and ([myTwilight:azimuth]>202 and [myTwilight:azimuth]<285) and [myTwilight:elevation]>30 and [Wettersensor2:TSL2561_Illuminance]>450 and [wdt_rollladen_di_fr_automode:state] eq "up")) ({fhem("set SZ_Rolladen 55")}) DOELSEIF ([di_Beschattung_Westseite:cmd] == 1 and ([myTwilight:azimuth]>202 and [myTwilight:azimuth]<285) and [myTwilight:elevation]>30 and [Wettersensor2:TSL2561_Illuminance]<400 and [wdt_rollladen_di_fr_automode:state] eq "up") ({fhem("set SZ_Rolladen 0")}) DOELSEIF ([di_Beschattung_Westseite:cmd] == 1 and [myTwilight:azimuth]>285 or [myTwilight:elevation]<30 and [wdt_rollladen_di_fr_automode:state] eq "up") ({fhem("set SZ_Rolladen 0")})

Über eine Anregung zur Beseitigung des Problems würde ich mich sehr freuen.

Gruß,

Stephan

amenomade

Bitte das gepinnte Post hier im Anfänger Forum lesen: "Unbedingt vor dem ersten Post lesen"
https://forum.fhem.de/index.php/topic,71806.0.html

"list" vom DOIF posten, am besten wenn er im "falschen" Zustand ist,
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

#2
Der Umweg über perl ist total überflüssig
({fhem("set SZ_Rolladen 55")})
schreibt man einfach
(set SZ_Rolladen 55)

Das ist aber nicht die Ursache des Problems

EDIT: die Klammersetzung im 3. Zweig ist dubios.
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

stephan20

Sorry für das fehlende List.

Internals:
   DEF        (([Wettersensor2:BME280_Temperatur]>24 and ([myTwilight:azimuth]>202 and [myTwilight:azimuth]<285) and [myTwilight:elevation]>30 and [Wettersensor2:TSL2561_Illuminance]>450 and [wdt_rollladen_di_fr_automode:state] eq "up")) ({fhem("set SZ_Rolladen 55")}) DOELSEIF ([di_Beschattung_Westseite:cmd] == 1 and ([myTwilight:azimuth]>202 and [myTwilight:azimuth]<285) and [myTwilight:elevation]>30 and [Wettersensor2:TSL2561_Illuminance]<400 and [wdt_rollladen_di_fr_automode:state] eq "up") ({fhem("set SZ_Rolladen 0")}) DOELSEIF ([di_Beschattung_Westseite:cmd] == 1 and [myTwilight:azimuth]>285 or [myTwilight:elevation]<30 and [wdt_rollladen_di_fr_automode:state] eq "up") ({fhem("set SZ_Rolladen 0")})
   FUUID      5ec6fb0b-f33f-60ca-3d4a-c55f480245db729e
   MODEL      FHEM
   NAME       di_Beschattung_Westseite
   NOTIFYDEV  di_Beschattung_Westseite,global,Wettersensor2,wdt_rollladen_di_fr_automode,myTwilight
   NR         537
   NTFY_ORDER 50-di_Beschattung_Westseite
   STATE      cmd_3
   TYPE       DOIF
   VERSION    21224 2020-02-18 18:45:49
   READINGS:
     2020-06-26 00:44:59   Device          myTwilight
     2020-06-24 18:19:35   cmd             3
     2020-06-24 18:19:35   cmd_count       1
     2020-06-24 18:19:35   cmd_event       myTwilight
     2020-06-24 18:19:35   cmd_nr          3
     2020-06-26 00:32:14   e_Wettersensor2_TSL2561_Illuminance 4.795
     2020-06-26 00:44:59   e_myTwilight_azimuth 347.74
     2020-06-26 00:44:59   e_myTwilight_elevation -14.44
     2020-06-25 22:26:47   e_wdt_rollladen_di_fr_automode_state down
     2020-06-24 11:57:21   mode            enabled
     2020-06-24 18:19:35   state           cmd_3
   Regex:
     accu:
     cond:
       Wettersensor2:
         0:
           BME280_Temperatur ^Wettersensor2$:^BME280_Temperatur:
           TSL2561_Illuminance ^Wettersensor2$:^TSL2561_Illuminance:
         1:
           TSL2561_Illuminance ^Wettersensor2$:^TSL2561_Illuminance:
         2:
       di_Beschattung_Westseite:
         0:
         1:
           cmd        ^di_Beschattung_Westseite$:^cmd:
         2:
           cmd        ^di_Beschattung_Westseite$:^cmd:
       myTwilight:
         0:
           azimuth    ^myTwilight$:^azimuth:
           elevation  ^myTwilight$:^elevation:
         1:
           azimuth    ^myTwilight$:^azimuth:
           elevation  ^myTwilight$:^elevation:
         2:
           azimuth    ^myTwilight$:^azimuth:
           elevation  ^myTwilight$:^elevation:
       wdt_rollladen_di_fr_automode:
         0:
           state      ^wdt_rollladen_di_fr_automode$:^state:
         1:
           state      ^wdt_rollladen_di_fr_automode$:^state:
         2:
           state      ^wdt_rollladen_di_fr_automode$:^state:
   attr:
     cmdState:
     cmdpause:
       900
     repeatsame:
       1
       1
       1
     wait:
     waitdel:
   condition:
     0          (::ReadingValDoIf($hash,'Wettersensor2','BME280_Temperatur')>24 and (::ReadingValDoIf($hash,'myTwilight','azimuth')>202 and ::ReadingValDoIf($hash,'myTwilight','azimuth')<285) and ::ReadingValDoIf($hash,'myTwilight','elevation')>30 and ::ReadingValDoIf($hash,'Wettersensor2','TSL2561_Illuminance')>450 and ::ReadingValDoIf($hash,'wdt_rollladen_di_fr_automode','state') eq "up")
     1          ::ReadingValDoIf($hash,'di_Beschattung_Westseite','cmd') == 1 and (::ReadingValDoIf($hash,'myTwilight','azimuth')>202 and ::ReadingValDoIf($hash,'myTwilight','azimuth')<285) and ::ReadingValDoIf($hash,'myTwilight','elevation')>30 and ::ReadingValDoIf($hash,'Wettersensor2','TSL2561_Illuminance')<400 and ::ReadingValDoIf($hash,'wdt_rollladen_di_fr_automode','state') eq "up"
     2          ::ReadingValDoIf($hash,'di_Beschattung_Westseite','cmd') == 1 and ::ReadingValDoIf($hash,'myTwilight','azimuth')>285 or ::ReadingValDoIf($hash,'myTwilight','elevation')<30 and ::ReadingValDoIf($hash,'wdt_rollladen_di_fr_automode','state') eq "up"
   do:
     0:
       0          {fhem("set SZ_Rolladen 55")}
     1:
       0          {fhem("set SZ_Rolladen 0")}
     2:
       0          {fhem("set SZ_Rolladen 0")}
     3:
   helper:
     DEVFILTER  ^global$|^di_Beschattung_Westseite$|^wdt_rollladen_di_fr_automode$|^Wettersensor2$|^myTwilight$
     NOTIFYDEV  global|di_Beschattung_Westseite|wdt_rollladen_di_fr_automode|Wettersensor2|myTwilight
     event      azimuth: 347.74,elevation: -14.44,twilight: 0,twilight_weather: 0,compasspoint: north-northwest
     globalinit 1
     last_timer 0
     sleeptimer -1
     timerdev   myTwilight
     timerevent azimuth: 316.82,elevation: -4.31,twilight: 42.7,twilight_weather: 42.7,compasspoint: northwest
     triggerDev myTwilight
     timerevents:
       azimuth: 316.82
       elevation: -4.31
       twilight: 42.7
       twilight_weather: 42.7
       compasspoint: northwest
     timereventsState:
       azimuth: 316.82
       elevation: -4.31
       twilight: 42.7
       twilight_weather: 42.7
       compasspoint: northwest
     triggerEvents:
       azimuth: 347.74
       elevation: -14.44
       twilight: 0
       twilight_weather: 0
       compasspoint: north-northwest
     triggerEventsState:
       azimuth: 347.74
       elevation: -14.44
       twilight: 0
       twilight_weather: 0
       compasspoint: north-northwest
   internals:
   readings:
     all         Wettersensor2:BME280_Temperatur myTwilight:azimuth myTwilight:elevation Wettersensor2:TSL2561_Illuminance wdt_rollladen_di_fr_automode:state di_Beschattung_Westseite:cmd
   trigger:
   uiState:
   uiTable:
Attributes:
   alias      Beschattung Westseite
   cmdpause   900
   repeatsame 1:1:1
   room       95_Timer


Das ist im State CMD3

Perl habe ich aus den Ausführungsteilen rausgenommen. Hmm, fehlt eine Klammer im 3. Zweig?

(([Wettersensor2:BME280_Temperatur]>24 and ([myTwilight:azimuth]>202 and [myTwilight:azimuth]<285) and [myTwilight:elevation]>30 and [Wettersensor2:TSL2561_Illuminance]>450 and [wdt_rollladen_di_fr_automode:state] eq "up")) (set SZ_Rolladen 55) DOELSEIF ([di_Beschattung_Westseite:cmd] == 1 and ([myTwilight:azimuth]>202 and [myTwilight:azimuth]<285) and [myTwilight:elevation]>30 and [Wettersensor2:TSL2561_Illuminance]<400 and [wdt_rollladen_di_fr_automode:state] eq "up") (set SZ_Rolladen 0) DOELSEIF ([di_Beschattung_Westseite:cmd] == 1 and [myTwilight:azimuth]>285 or [myTwilight:elevation]<30 and [wdt_rollladen_di_fr_automode:state] eq "up") (set SZ_Rolladen 0)

amenomade

#4
myTwilight:elevation ist <30 => cmd3

Zitat von: stephan20 am 26 Juni 2020, 00:53:00
Hmm, fehlt eine Klammer im 3. Zweig?
Ich weiss nicht, du kennst deine Logik besser als ich, ich finde es nur komisch, dass es so aussieht:
[di_Beschattung_Westseite:cmd] == 1 and [myTwilight:azimuth]>285
or
[myTwilight:elevation]<30 and [wdt_rollladen_di_fr_automode:state] eq "up"

Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

stephan20

Nachdem du mich ja in dem anderen Post auf den Rechtschreibfehler gebracht hast, denke ich sollte es jetzt funktionieren. Habe den 3. Zwei jetzt nochmal so abgeändert

DOELSEIF ([di_Beschattung_Westseite:cmd] == 1 and ([myTwilight:azimuth]>285 or [myTwilight:elevation]<30) and [wdt_rollladen_di_fr_automode:state] eq "up") (set SZ_Rolladen 0)

Ich hoffe, dass die Zusammenfassung von zwei Bedingungen in Klammer, also entweder die eine und/oder die andere soll wahr sein.

amenomade

Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus