FHEM Forum

FHEM => English Corner => Thema gestartet von: fruit am 16 November 2015, 19:36:03

Titel: featurelevel 5.7
Beitrag von: fruit am 16 November 2015, 19:36:03
I updated this morning but saw errors so restored and looked over my config but cannot see anything obvious - possibly looking too hard :(
So, I updated again this evening but still see the same errors
define Heating_Changes_notify notify .*([Mm]ode|[Pp]ower[Oo]n|[Hh]eating[Tt]hreshold|[Vv]alve[Pp]osition).* {\
valve_pos( ReadingsVal( "HeatingThreshold", "state", 50 ) );;\
my $valve = 0;;\
my @@pos = ( );;\
my $demand = 0;;\
my @@Max_HT = devspec2array( "DEF=HeatingThermostat.*" );;\
foreach( @@Max_HT ) \
{\
  $valve = ReadingsVal( $_, "valveposition", 101 );;\
  push( @@pos, $valve );;\
  $demand = $demand + $valve;;\
}\
fhem "set Demand $demand";;\
}

Internals:
   DEF        .*([Mm]ode|[Pp]ower[Oo]n|[Hh]eating[Tt]hreshold|[Vv]alve[Pp]osition).* {
valve_pos( ReadingsVal( "HeatingThreshold", "state", 50 ) );
my $valve = 0;
my @@pos = ( );
my $demand = 0;
my @@Max_HT = devspec2array( "DEF=HeatingThermostat.*" );
foreach( @@Max_HT )
{
  $valve = ReadingsVal( $_, "valveposition", 101 );
  push( @@pos, $valve );
  $demand = $demand + $valve;
}
fhem "set Demand $demand";
}
   NAME       Heating_Changes_notify
   NR         753
   NTFY_ORDER 50-Heating_Changes_notify
   REGEXP     .*([Mm]ode|[Pp]ower[Oo]n|[Hh]eating[Tt]hreshold|[Vv]alve[Pp]osition).*
   STATE      2015-11-16 18:29:18
   TYPE       notify
   Readings:
     2015-11-16 18:07:19   state           active
Attributes:
   room       Heat_Control


syntax error at (eval 1249) line 12, at EOF
syntax error at (eval 1249) line 10, near "@@pos"
syntax error at (eval 1249) line 7, near "@@Max_HT "
syntax error at (eval 1249) line 6, near "@@Max_HT "
Can't use global @@ in "my" at (eval 1249) line 6, near "my @@"
syntax error at (eval 1249) line 4, near "@@pos"
2015.11.16 18:09:59 3: Heating_Changes_notify return value: Can't use global @@ in "my" at (eval 1249) line 4, near "my @@"
}
fhem "set Demand $demand";
}
  $demand = $demand + $valve;
  push( @@pos, $valve );
  $valve = ReadingsVal( $_, "valveposition", 101 );
{
foreach( @@Max_HT )
my @@Max_HT = devspec2array( "DEF=HeatingThermostat.*" );
my $demand = 0;
my @@pos = ( );
my $valve = 0;
valve_pos( ReadingsVal( "HeatingThreshold", "state", 50 ) );
2015.11.16 18:09:59 3: eval: {
2015.11.16 18:09:59 1: PERL WARNING: Bareword found where operator expected at (eval 1249) line 7, near "@@Max_HT"
}
fhem "set Demand $demand";
}
  $demand = $demand + $valve;
  push( @@pos, $valve );
  $valve = ReadingsVal( $_, "valveposition", 101 );
{
foreach( @@Max_HT )
my @@Max_HT = devspec2array( "DEF=HeatingThermostat.*" );
my $demand = 0;
my @@pos = ( );
my $valve = 0;
valve_pos( ReadingsVal( "HeatingThreshold", "state", 50 ) );
2015.11.16 18:09:59 3: eval: {
2015.11.16 18:09:59 1: PERL WARNING: Bareword found where operator expected at (eval 1249) line 6, near "@@Max_HT"
}
fhem "set Demand $demand";
}
  $demand = $demand + $valve;
  push( @@pos, $valve );
  $valve = ReadingsVal( $_, "valveposition", 101 );
{
foreach( @@Max_HT )
my @@Max_HT = devspec2array( "DEF=HeatingThermostat.*" );
my $demand = 0;
my @@pos = ( );
my $valve = 0;
valve_pos( ReadingsVal( "HeatingThreshold", "state", 50 ) );
2015.11.16 18:09:59 3: eval: {
2015.11.16 18:09:59 1: PERL WARNING: "state" variable @@ masks earlier declaration in same scope at (eval 1249) line 6.


I guess it does not like the @@ but what is the alternative in this situation?
Titel: Antw:featurelevel 5.7
Beitrag von: dev0 am 16 November 2015, 19:43:59
With featurelevel 5.7 and above you have to use @ instead of @@. Please have a look at commandref and search for "deprecated".
Titel: Antw:featurelevel 5.7
Beitrag von: fruit am 16 November 2015, 20:06:22
I wondered if that was the case, I even changed them after restore but got errors so changed back.
I should have tried before the restore :(

Many thanks
Titel: Antw:featurelevel 5.7
Beitrag von: hobu am 29 November 2015, 16:02:10
Just ran in this issue as well.
After using the workaround "attr global featurelevel 5.6" at least my skript (similar to your one) was working again.
Obviously not the final solution...

Anyway: Thx to dev0 for the hint to this in the commandref.
Titel: Antw:featurelevel 5.7
Beitrag von: fruit am 29 November 2015, 17:25:59
The problem is that if you edit the script ready for 5.7 while running 5.6 it errors

Best is to try and disable it or alter from the def window then copy back a suitably modified script after update