Problem beim definieren eines at innerhalb eines at

Begonnen von aga, 12 Dezember 2015, 21:22:35

Vorheriges Thema - Nächstes Thema

aga

Abend zusammen,

ich hoffe sehr, dass jemand sieht oder weiß was hier falsch ist.

Ich habe ein at, was funktionierte, aber ich wollte es etwas intelligenter machen, nun klappt es nicht mehr.
Im logfile stehen jede Menge warnings, nur weiß ich nach dem x-ten Mal lesen immer noch nicht, was mir Perl damit sagen will.

Was will ich machen?
-Licht an bei sunset
-Timer definieren, um 1 Stunde später den Rolladen runter zu machen
-dieses at in den room Timer verfrachten

Die Rechnerei in dem at rührt daher, weil der Fibaro Roller Shutter die Angewohnheit hat, dass nach jedem Runter-/Hochfahren "up" nicht mehr 99, sondern 98 und dann bei jedem Mal immer weniger wird.
Also möchte ich den Wert, den ich einstelle, am jeweiligen up-Zustand berechnen.

Dass das ganze Konstrukt nicht funktioniert, liegt ziemlich sicher an dem define t_rolla_down_after_light_on at...
Als da nur drin stand, "set WZ_Rolladen dim 50" war alles gut.

Das define selbst am fhem Prompt abgesetzt funktioniert wie es soll, nur innerhalb des anderen at nicht.

Vielleicht nur übersehen, etwas zu escapen oder Klammer vergessen/zuviel? Ich weiß es nicht, seit letztem Wochenende probiere ich, aber ich bekomme es nicht hin.

Hier der Code aus dem Details Editor

+*{sunset_rel("HORIZON=3",0,"16:30","22:00")} {if(Value('HomeStatus') != '4') {fhem("set WZ_Lichtschalter_id5 on;define t_rolla_down_after_light_on at +01:00:00 {my $cd = int(sprintf("%02d",ReadingsVal("RolladenWZ","up_pos",99))*50/99);;fhem("set RolladenWZ dim ".$cd)};attr t_rolla_down_after_light_on room Timer")}}

Und der Auszug aus dem Logfile

2015.12.12 19:51:00 5: exec at command WZ_LichtONatSunset
2015.12.12 19:51:00 5: Cmd: >{if(Value('HomeStatus') != '4') {fhem("set WZ_Lichtschalter_id5 on;define t_rolla_down_after_light_on at +01:00:00 {my $cd = int(sprintf("%02d",ReadingsVal("RolladenWZ","up_pos",99))*50/99);;fhem("set RolladenWZ dim ".$cd)};attr t_rolla_down_after_light_on room Timer")}}<
2015.12.12 19:51:00 1: PERL WARNING: Bareword found where operator expected at (eval 136861) line 1, near "02d"
2015.12.12 19:51:00 3: eval: {if(Value('HomeStatus') != '4') {fhem("set WZ_Lichtschalter_id5 on;define t_rolla_down_after_light_on at +01:00:00 {my $cd = int(sprintf("%02d",ReadingsVal("RolladenWZ","up_pos",99))*50/99);;fhem("set RolladenWZ dim ".$cd)};attr t_rolla_down_after_light_on room Timer")}}
2015.12.12 19:51:00 1: PERL WARNING: String found where operator expected at (eval 136861) line 1, near "d",ReadingsVal(""
2015.12.12 19:51:00 3: eval: {if(Value('HomeStatus') != '4') {fhem("set WZ_Lichtschalter_id5 on;define t_rolla_down_after_light_on at +01:00:00 {my $cd = int(sprintf("%02d",ReadingsVal("RolladenWZ","up_pos",99))*50/99);;fhem("set RolladenWZ dim ".$cd)};attr t_rolla_down_after_light_on room Timer")}}
2015.12.12 19:51:00 1: PERL WARNING: Bareword found where operator expected at (eval 136861) line 1, near "",ReadingsVal("RolladenWZ"
2015.12.12 19:51:00 3: eval: {if(Value('HomeStatus') != '4') {fhem("set WZ_Lichtschalter_id5 on;define t_rolla_down_after_light_on at +01:00:00 {my $cd = int(sprintf("%02d",ReadingsVal("RolladenWZ","up_pos",99))*50/99);;fhem("set RolladenWZ dim ".$cd)};attr t_rolla_down_after_light_on room Timer")}}
2015.12.12 19:51:00 1: PERL WARNING: String found where operator expected at (eval 136861) line 1, near "RolladenWZ",""
2015.12.12 19:51:00 3: eval: {if(Value('HomeStatus') != '4') {fhem("set WZ_Lichtschalter_id5 on;define t_rolla_down_after_light_on at +01:00:00 {my $cd = int(sprintf("%02d",ReadingsVal("RolladenWZ","up_pos",99))*50/99);;fhem("set RolladenWZ dim ".$cd)};attr t_rolla_down_after_light_on room Timer")}}
2015.12.12 19:51:00 1: PERL WARNING: Bareword found where operator expected at (eval 136861) line 1, near "","up_pos"
2015.12.12 19:51:00 3: eval: {if(Value('HomeStatus') != '4') {fhem("set WZ_Lichtschalter_id5 on;define t_rolla_down_after_light_on at +01:00:00 {my $cd = int(sprintf("%02d",ReadingsVal("RolladenWZ","up_pos",99))*50/99);;fhem("set RolladenWZ dim ".$cd)};attr t_rolla_down_after_light_on room Timer")}}
2015.12.12 19:51:00 1: PERL WARNING: String found where operator expected at (eval 136861) line 1, near "up_pos",99))*50/99);;fhem(""
2015.12.12 19:51:00 3: eval: {if(Value('HomeStatus') != '4') {fhem("set WZ_Lichtschalter_id5 on;define t_rolla_down_after_light_on at +01:00:00 {my $cd = int(sprintf("%02d",ReadingsVal("RolladenWZ","up_pos",99))*50/99);;fhem("set RolladenWZ dim ".$cd)};attr t_rolla_down_after_light_on room Timer")}}
2015.12.12 19:51:00 1: PERL WARNING: Bareword found where operator expected at (eval 136861) line 1, near "",99))*50/99);;fhem("set"
2015.12.12 19:51:00 3: eval: {if(Value('HomeStatus') != '4') {fhem("set WZ_Lichtschalter_id5 on;define t_rolla_down_after_light_on at +01:00:00 {my $cd = int(sprintf("%02d",ReadingsVal("RolladenWZ","up_pos",99))*50/99);;fhem("set RolladenWZ dim ".$cd)};attr t_rolla_down_after_light_on room Timer")}}
2015.12.12 19:51:00 1: PERL WARNING: String found where operator expected at (eval 136861) line 1, near "dim ".$cd)};attr t_rolla_down_after_light_on room Timer""
2015.12.12 19:51:00 3: eval: {if(Value('HomeStatus') != '4') {fhem("set WZ_Lichtschalter_id5 on;define t_rolla_down_after_light_on at +01:00:00 {my $cd = int(sprintf("%02d",ReadingsVal("RolladenWZ","up_pos",99))*50/99);;fhem("set RolladenWZ dim ".$cd)};attr t_rolla_down_after_light_on room Timer")}}
2015.12.12 19:51:00 3: WZ_LichtONatSunset: Global symbol "$cd" requires explicit package name at (eval 136861) line 1.
syntax error at (eval 136861) line 1, near "02d"

2015.12.12 19:51:00 5: redefine at command WZ_LichtONatSunset as +*{sunset_rel("HORIZON=3",0,"16:30","22:00")} {if(Value('HomeStatus') != '4') {fhem("set WZ_Lichtschalter_id5 on;define t_rolla_down_after_light_on at +01:00:00 {my $cd = int(sprintf("%02d",ReadingsVal("RolladenWZ","up_pos",99))*50/99);;fhem("set RolladenWZ dim ".$cd)};attr t_rolla_down_after_light_on room Timer")}}


Letztlich ist es wahrscheinlich nur ein Fehler und alles andere Folgefehler. Aber ich sehe womögleich den Wald vor lauter Bäumen nicht mehr.

Danke schonmal und schönen Abend.

Gruß
Andreas