myAverage function throws error: Experimental aliasing via reference not enabled

Begonnen von @lex99, 05 Februar 2022, 21:52:21

Vorheriges Thema - Nächstes Thema

@lex99

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 !

rudolfkoenig

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?

herrmannj



@lex99

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 ?

herrmannj

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

Beta-User

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.
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn: u.a MySensors, Weekday-&RandomTimer, Twilight,  div. attrTemplate-files