Ereignisabhängige Rolladensteuerung - DOIF - Denkfehler?

Begonnen von Tedious, 07 September 2017, 11:04:17

Vorheriges Thema - Nächstes Thema

Tedious

Guten Morgen zusammen,

irgendwo scheine ich einen Knoten m Hirn zu haben, es geht um folgendes Doif:

([sonoff_sw2:BH1750_Illuminance] > 60 and [sonoffpow_2:Power] > 50 and [Rol.WZFenster:pct] > 40) (set Rol.WZFenster pct 40) DOELSEIF ([06:00-23:00] and [sonoffpow_2:Power] < 50 and [Rol.WZFenster:pct] = 40) (set Rol.WZFenster pct 100)

Folgendes soll passieren:

- Ein Sonoff mit BH1750-Sensor misst die Helligkeit am/über dem TV, der liegt einem großen Fenster gegenüber - dessen Rolladen wird via HM von Rol.WZFenster gesteuert. Wenn der TV an ist steigt der Verbrauch am Sonoff über/um 60W.

- Das Doif soll erkennen es ist hell [sonoff_sw2:BH1750_Illuminance] > 60, der TV ist an [sonoffpow_2:Power] > 50 und der Rollo schattet nicht ab and [Rol.WZFenster:pct] > 40  --> Rolladen 60% zu fahren. Das funktioniert soweit set Rol.WZFenster pct 40

Nun soll er, wenn der TV aus ist tagsüber den Rollo wieder hoch fahren...

- [06:00-23:00] tagsüber, wenn TV aus [sonoffpow_2:Power] < 50 (an dem Sonoff hängt auch ein AVR, also wenn nur Musik spielt bitte auch hoch fahren...) und die TV-Abschattung nicht mehr gebraucht wird [Rol.WZFenster:pct] = 40 (er soll nur bei exakt 40% fahren, denn nur denn wurde er vom Doif dort hin gefahren... kann ja sein dass man von hand ein wenig abgeschattet hat, dass man exakt 40% getroffen hat ist da eher unwahrscheinlich...) fahre bitte wieder hoch set Rol.WZFenster pct 100. Genau da macht er leider nicht.

Irgendwas scheint mit meinem Zeit-Operanden nicht zu stimmen, aber im Prinzip stehts ja so im Wiki:

define di_lamp DOIF ([06:00-19:00] and [sensor:brightness] < 40) (set lamp on) DOELSE (set lamp off)

Das Logfine spuckt aber einen Fehler aus:

2017.09.07 10:42:45 1: PERL WARNING: Useless use of a constant ("06:00") in void context at (eval 87115) line 1.
2017.09.07 10:42:45 3: eval: RolloTV: warning in condition c02


Mir ist nicht klar wo mein Denkfehler liegt... jemad einen tip für mich?

Hier noch ein List:


Internals:
   CFGFN
   DEF        ([sonoff_sw2:BH1750_Illuminance] > 60 and [sonoffpow_2:Power] > 50 and [Rol.WZFenster:pct] > 40) (set Rol.WZFenster pct 40) DOELSEIF ([06:00-23:00] and [sonoffpow_2:Power] < 50 and [Rol.WZFenster:pct] = 40) (set Rol.WZFenster pct 100)
   NAME       RolloTV
   NR         33158
   NTFY_ORDER 50-RolloTV
   STATE      initialize
   TYPE       DOIF
   Helper:
     DBLOG:
       cmd:
         myDbLog:
           TIME       1504773879.1067
           VALUE      0
       cmd_event:
         myDbLog:
           TIME       1504773165.14873
           VALUE      Rol.WZFenster
       cmd_nr:
         myDbLog:
           TIME       1504773165.14873
           VALUE      1
       cmd_seqnr:
         myDbLog:
           TIME       1504773160.18525
           VALUE      2
       error:
         myDbLog:
           TIME       1504773160.09197
           VALUE      [06:00-23:00] and 65 < 50 and 40 = 40
       last_cmd:
         myDbLog:
           TIME       1504773171.12138
           VALUE      cmd_1
       mode:
         myDbLog:
           TIME       1504773977.31546
           VALUE      enable
       state:
         myDbLog:
           TIME       1504774218.83047
           VALUE      initialize
   READINGS:
     2017-09-07 10:47:46   Device          sonoffpow_2
     2017-09-07 10:46:43   e_sonoff_sw2_BH1750_Illuminance 70
     2017-09-07 10:47:46   e_sonoffpow_2_Power 5
     2017-09-07 10:47:46   error           condition c02: Can't modify non-lvalue subroutine call in scalar assignment, line 1, at EOF

     2017-09-07 10:50:18   state           initialize
     2017-09-07 10:44:39   timer_01_c02    08.09.2017 06:00:00
     2017-09-07 10:44:39   timer_02_c02    07.09.2017 23:00:00
   condition:
     0          ReadingValDoIf($hash,'sonoff_sw2','BH1750_Illuminance') > 60 and ReadingValDoIf($hash,'sonoffpow_2','Power') > 50 and ReadingValDoIf($hash,'Rol.WZFenster','pct') > 40
     1          DOIF_time($hash,0,1,$wday,$hms) and ReadingValDoIf($hash,'sonoffpow_2','Power') < 50 and ReadingValDoIf($hash,'Rol.WZFenster','pct') = 40
   days:
   devices:
     0           sonoff_sw2 sonoffpow_2 Rol.WZFenster
     1           sonoffpow_2 Rol.WZFenster
     all         sonoff_sw2 sonoffpow_2 Rol.WZFenster
   do:
     0:
       0          set Rol.WZFenster pct 40
     1:
       0          set Rol.WZFenster pct 100
     2:
   helper:
     event      Power: 5,Total: 6.821,Yesterday: 0.293,Today: 0.165,Time: 2017-09-07T09:47:46,Period: 0,Voltage: 227,Current: 0.122,Factor: 0.2
     globalinit 1
     last_timer 2
     sleeptimer -1
     triggerDev sonoffpow_2
     triggerEvents:
       Power: 5
       Total: 6.821
       Yesterday: 0.293
       Today: 0.165
       Time: 2017-09-07T09:47:46
       Period: 0
       Voltage: 227
       Current: 0.122
       Factor: 0.2
     triggerEventsState:
       Power: 5
       Total: 6.821
       Yesterday: 0.293
       Today: 0.165
       Time: 2017-09-07T09:47:46
       Period: 0
       Voltage: 227
       Current: 0.122
       Factor: 0.2
   internals:
   interval:
     0          -1
     1          0
   itimer:
   localtime:
     0          1504843200
     1          1504818000
   readings:
     0           sonoff_sw2:BH1750_Illuminance sonoffpow_2:Power Rol.WZFenster:pct
     1           sonoffpow_2:Power Rol.WZFenster:pct
     all         sonoff_sw2:BH1750_Illuminance sonoffpow_2:Power Rol.WZFenster:pct
   realtime:
     0          06:00:00
     1          23:00:00
   regexp:
     0:
     1:
     all:
   state:
     STATE:
   time:
     0          06:00:00
     1          23:00:00
   timeCond:
     0          1
     1          1
   timer:
     0          0
     1          0
   timers:
     1           0  1
   trigger:
   triggertime:
     1504818000:
       localtime  1504818000
       hash:
     1504843200:
       localtime  1504843200
       hash:
Attributes:
   room       Rollladen


Danke und Grüße

Sascha
FHEM auf Proxmox-VM (Intel NUC) mit 4xMapleCUN (433,3x868) und Jeelink, HUE, MiLight, Max!, SonOff, Zigbee, Alexa, uvm...

nils_

die warning:
2017-09-07 10:47:46   error           condition c02: Can't modify non-lvalue subroutine call in scalar assignment, line 1, at EOF
kommt von diesem teil
and [Rol.WZFenster:pct] = 40

'=' ist eine Zuweisung, du willst aber vergleichen, versuch es mit '==' (sicher bin ich mir aber nicht, ob er wirklich immer exakt bei 40 steht!)
viele Wege in FHEM es gibt!

Tedious

Danke für den Tip. Mist, mal wieder ne Kleinigkeit übersehen... == statt =, oder halt eq. Manchmal sieht man den Wald vor lauter Bäumen nicht. Danke!
FHEM auf Proxmox-VM (Intel NUC) mit 4xMapleCUN (433,3x868) und Jeelink, HUE, MiLight, Max!, SonOff, Zigbee, Alexa, uvm...