Mehrfachbedingung für DOIF

Begonnen von AndyMu, 03 Februar 2017, 19:51:09

Vorheriges Thema - Nächstes Thema

AndyMu

Hallo zusammen,

ich gebe auf... ich finde einfach nicht raus, wo mein Problem ist.
Das DOIF sieht so aus:
([15:00-23:00] and [DevDummy] <70 and [DevDummy] >=30 and [eg_wz_dim_LED_Sw] ne "on")({
use Math::Round qw/round/;;
my $tlw=Value("DevDummy");;
#my $tlw=ReadingsVal("myTL","twilight_weather",100)
$tlw=abs($tlw-50);;
$tlw=Math::Round::round($tlw);;
my $proz=$tlw*2.5;;
if($proz<100){fhem("set eg_wz_dim_LED_Sw $proz")}
else{fhem("set eg_wz_dim_LED_Sw on")}

})
DOELSE

Ich bekomme die Fehlermeldung
Ambienteautomatik: {    use Math::Round qw/round/;;    my $tlw=Value("DevDummy");;    #my $tlw=ReadingsVal("myTL","twilight_weather",100)    $tlw=abs($tlw-50);;    $tlw=Math::Round::round($tlw);;    my $proz=$tlw*2.5;;    if($proz<100){fhem("set eg_wz_dim_LED_Sw $proz")}       else{fhem("set eg_wz_dim_LED_Sw on")}     }: Missing right curly or square bracket at (eval 159561) line 1, at end of line
syntax error at (eval 159561) line 1, at EOF

Selbst wenn ich alle Berechnungslogik in der DOIF rausnehme und nur den Rumpf stehen lasse:
([15:00-23:00] and [DevDummy] <70 and [DevDummy] >=30 and [eg_wz_dim_LED_Sw] ne "on")({
})DOELSE

Bekomm ich eine Fehlermeldung... es liegt also irgendwie daran, wie ich die Bedingungen abfrage.
DevDummy ist ein Werte-Dummy, mit dem ich das twilight_weather simulieren möchte, eigentlich soll da [myTL:twilight_weather] stehen.

Ihr könnt das vielleicht sofort sehen, ich stehe total aufm Schlauch... danke für eure Hilfe!

Ellert

Mit
([1])({
})DOELSE

gibt es keine Fehlermeldung ist ein Modul aktuell?
Ggf. die Funktion in die myUtils verlegen.

AndyMu

Komisch, mein Zielcode
([15:00-23:00] and [myTL:twilight_weather] <70 and [myTL:twilight_weather] >=30 and [eg_wz_dim_LED_Sw] ne "on")({
use Math::Round qw/round/;;
my $tlw=ReadingsVal("myTL","twilight_weather",100);;
$tlw=abs($tlw-70);;
$tlw=Math::Round::round($tlw);;
my $proz=$tlw*2.5;;
if($proz<100){fhem("set eg_wz_dim_LED_Sw $proz")}
else{fhem("set eg_wz_dim_LED_Sw on")}
})DOELSE

scheint es jetzt so zu tun, wie ich es gedacht hatte... was ist anders?

AndyMu

#3
Sehr interessant... der Code oben funzt.
Aber wenn ich die Zeile
my $tlw=ReadingsVal("myTL","twilight_weather",100);;
dopple und sie auskommentiert dazu einfüge:
#my $tlw=ReadingsVal("myTL","twilight_weather",100);;
bekomme ich die "missing curly..." Fehlermeldung.

Funktioniert:
([15:00-23:00] and [myTL:twilight_weather] <70 and [myTL:twilight_weather] >=0 and [eg_wz_dim_LED_Sw] ne "on")({
use Math::Round qw/round/;;
my $tlw=ReadingsVal("myTL","twilight_weather",100);;
$tlw=abs($tlw-70);;
$tlw=Math::Round::round($tlw);;
my $proz=$tlw*2.5;;
if($proz<100){fhem("set eg_wz_dim_LED_Sw $proz")}
else{fhem("set eg_wz_dim_LED_Sw on")}
})DOELSE

Funktioniert nicht:
([15:00-23:00] and [myTL:twilight_weather] <70 and [myTL:twilight_weather] >=0 and [eg_wz_dim_LED_Sw] ne "on")({
use Math::Round qw/round/;;
my $tlw=ReadingsVal("myTL","twilight_weather",100);;
        #my $tlw=ReadingsVal("myTL","twilight_weather",100);;
$tlw=abs($tlw-70);;
$tlw=Math::Round::round($tlw);;
my $proz=$tlw*2.5;;
if($proz<100){fhem("set eg_wz_dim_LED_Sw $proz")}
else{fhem("set eg_wz_dim_LED_Sw on")}
})DOELSE

Ist denn das "#" kein Zeichen fürs Auskommentieren?