Hi,
I'm trying to use the function myAverage (from the Wiki).
Upon typing this:
define KS300_W_notify notify KS300:wind.* {\
my $avg = myAverage("10800", "FileLog_KS300", "8:::");;\
my $event = sprintf("Wc: %0.1f Wd: %0.1f Wm: %0.1f Wlh: %0.1f", ReadingsVal("KS300","wind","0"), ReadingsVal("KS300", "W_avg_day","0"), ReadingsVal("KS300","W_avg_month","0"), $avg);;\
Log 2, ("K300_W: Event: $event");;\
fhem("trigger KS300_W data: $event");;\
fhem("trigger KS300 average-wind: $avg");;\
}
I get: Experimental aliasing via reference not enabled
Can a Perl expert help here ?
Thanks !
ZitatUpon typing this:
What exactly do you mean by "typing"?
I get no message at all, when I'm typing that :)
What is your perl version?
the backslashes throw that error
I have Perl 5.24.1
Zitat von: herrmannj am 06 Februar 2022, 16:30:22
the backslashes throw that error
OK, thanks - it works in a single line. Best to modify in the wiki then to avoid confusion.
Should I upgrade my Perl to the latest one ? Via Perlbrew ?
Works but not that easy. Either via os upgrade or let it go, unless you know how to do it via perlbrew. Fhem usually runs with the user fhem
Zitat von: @lex99 am 06 Februar 2022, 16:40:54
Best to modify in the wiki then to avoid confusion.
...not sure about that..
You are referring to the notify at the end of https://wiki.fhem.de/wiki/Gleitende_Mittelwerte_berechnen_und_loggen#Funktion_myAverage.28.29_aufrufen_und_nutzen?
The format shown there is the "RAW"-Format as explained in https://wiki.fhem.de/wiki/Import_von_Code_Snippets. You will find that kind of notation throughout the entire Wiki, so it's not possible to eleminate that completely despite the fact it might be possible in this single case.
Note: there had been some "use POSIX;"-lines in the shown code in the wiki. Please delete these also in your code.