From b3a9f1f13b6bb1373c1fbfbaf52b406bc05620c9 Mon Sep 17 00:00:00 2001 From: betateilchen <> Date: Sun, 8 Jan 2017 11:19:58 +0000 Subject: [PATCH] cloneDummy.pm: minor changes git-svn-id: https://svn.fhem.de/fhem/trunk@13009 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_cloneDummy.pm | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/fhem/FHEM/98_cloneDummy.pm b/fhem/FHEM/98_cloneDummy.pm index 99f63d43d..3b39ad785 100644 --- a/fhem/FHEM/98_cloneDummy.pm +++ b/fhem/FHEM/98_cloneDummy.pm @@ -1,4 +1,8 @@ # $Id$ + +# +# interims check-in with some bugfixes (betateilchen) 2017-01-07 +# ################################################################################ # 98_cloneDummy # Von Joachim Herold @@ -33,6 +37,7 @@ sub cloneDummy_Initialize($) { $hash->{DefFn} = "cloneDummy_Define"; $hash->{NotifyFn} = "cloneDummy_Notify"; $hash->{AttrList} = "cloneIgnore " + ."deleteBeforeUpdate:0,1 " ."addStateEvent:0,1 " .$readingFnAttributes; } @@ -51,8 +56,9 @@ sub cloneDummy_Define($$) { if($a[0] eq $a[2]); my $hn = $hash->{NAME}; - $hash->{NOTIFYDEV} = $a[2]; - $hash->{NOTIFYSTATE} = $a[3] if(defined($a[3])); + $hash->{NOTIFYDEV} = '.*'; +# $hash->{NOTIFYDEV} = $a[2]; +# $hash->{NOTIFYSTATE} = $a[3] if(defined($a[3])); $attr{$hn}{stateFormat} = "_state" if(defined($a[3])); readingsSingleUpdate($hash,'state','defined',1); Log3($hash,4,"cloneDummy: $a[0] defined for source $a[2]"); @@ -73,7 +79,8 @@ sub cloneDummy_Notify($$) { $hs = $hash->{NOTIFYSTATE}; } - readingsSingleUpdate($hash,"state", "active",1); + CommandDeleteReading(undef,"$hn .*") if(AttrVal($hn,'deleteBeforeUpdate',0)); + readingsBeginUpdate($hash); for(my $i=0;$i<$max;$i++){ @@ -99,7 +106,7 @@ sub cloneDummy_Notify($$) { } } - readingsEndUpdate($hash, 1); +# readingsEndUpdate($hash, 1); return; } @@ -107,6 +114,8 @@ sub cloneDummy_Notify($$) { 1; =pod +=item summary clone a device and its readings +=item summary_DE klont ein device und seine readings =begin html @@ -158,6 +167,9 @@ sub cloneDummy_Notify($$) {
  • cloneIgnore
    - comma separated list of readingnames that will NOT be generated.
    Usefull to prevent truncated readingnames coming from state events.
  • +
    +
  • deleteBeforeUpdate
    + If set to 1, all readings will be deleted befor update.

  • readingFnAttributes
  • @@ -226,6 +238,9 @@ sub cloneDummy_Notify($$) { Eine durch Kommata getrennte Liste der readings, die cloneDummy nicht in eigene readings umwandelt
    +
  • deleteBeforeUpdate
    + Ist dieses Attribut auf 1 gesetzt, werden alle readings zuerst gelöscht, bevor neue Readings geschrieben werden.
  • +
  • readingFnAttributes