From e6f06b45fc2ffb7a7f1eacb8ad85caa2da30c889 Mon Sep 17 00:00:00 2001 From: justme1968 Date: Fri, 31 Mar 2017 21:41:57 +0000 Subject: [PATCH] 33_readingsProxy.pm: fixed check for ''. see forum https://forum.fhem.de/index.php/topic,69851.0/topicseen.html git-svn-id: https://svn.fhem.de/fhem/trunk@13861 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/33_readingsProxy.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fhem/FHEM/33_readingsProxy.pm b/fhem/FHEM/33_readingsProxy.pm index f25bea21b..9ce6a8ac8 100644 --- a/fhem/FHEM/33_readingsProxy.pm +++ b/fhem/FHEM/33_readingsProxy.pm @@ -132,7 +132,7 @@ readingsProxy_update($$) my $value_fn = eval $value_fn; Log3 $name, 3, $name .": valueFn: ". $@ if($@); return undef if( !defined($value_fn) ); - $value = $value_fn if( $value_fn ); + $value = $value_fn if( $value_fn ne '' ); } if( AttrVal($name, 'event-on-change-reading', undef ) || AttrVal($name, 'event-on-update-reading', undef ) ) { @@ -256,7 +256,7 @@ readingsProxy_Set($@) readingsSingleUpdate($hash, "lastCmd", $a[0], 0); return undef if( !defined($set_fn) ); - $v = $set_fn if( $set_fn ); + $v = $set_fn if( $set_fn ne '' ); } else { readingsSingleUpdate($hash, "lastCmd", $a[0], 0); } @@ -304,7 +304,7 @@ readingsProxy_Get($@) Log3 $name, 3, $name .": getFn: ". $@ if($@); return $get_fn if($direct_return); return undef if( !defined($get_fn) ); - $v = $get_fn if( $get_fn ); + $v = $get_fn if( $get_fn ne '' ); } if( $hash->{INGET} ) { @@ -402,14 +402,14 @@ readingsProxy_Attr($$$;$) perl expresion that will return the get command forwarded to the parent device. has access to $DEVICE, $READING, $CMD and $ARGS.
undef -> do nothing
- "" -> pass-through
+ "" -> pass through
(,1) -> directly return , don't call parent getFn
everything else -> use this instead
  • setFn
    perl expresion that will return the set command forwarded to the parent device. has access to $CMD, $DEVICE, $READING and $ARGS.
    undef -> do nothing
    - "" -> pass-through
    + "" -> pass through
    everything else -> use this instead
    Examples:
    attr myProxy setFn {($CMD eq "on")?"off":"on"} @@ -418,7 +418,7 @@ readingsProxy_Attr($$$;$) perl expresion that will return the value that sould be used as state. has access to $LASTCMD, $DEVICE, $READING and $VALUE.
    undef -> do nothing
    - "" -> pass-through
    + "" -> pass through
    everything else -> use this instead
    Examples:
    attr myProxy valueFn {($VALUE == 0)?"off":"on"}