2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 01:14:19 +00:00

98_cloneDummy.pm: add item helper and summary

git-svn-id: https://svn.fhem.de/fhem/trunk@13011 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2017-01-08 13:37:59 +00:00
parent 52ba979ad8
commit 46ef146e06

View File

@ -1,8 +1,4 @@
# $Id$ # $Id$
#
# interims check-in with some bugfixes (betateilchen) 2017-01-07
#
################################################################################ ################################################################################
# 98_cloneDummy # 98_cloneDummy
# Von Joachim Herold # Von Joachim Herold
@ -37,7 +33,6 @@ sub cloneDummy_Initialize($) {
$hash->{DefFn} = "cloneDummy_Define"; $hash->{DefFn} = "cloneDummy_Define";
$hash->{NotifyFn} = "cloneDummy_Notify"; $hash->{NotifyFn} = "cloneDummy_Notify";
$hash->{AttrList} = "cloneIgnore " $hash->{AttrList} = "cloneIgnore "
."deleteBeforeUpdate:0,1 "
."addStateEvent:0,1 " ."addStateEvent:0,1 "
.$readingFnAttributes; .$readingFnAttributes;
} }
@ -56,9 +51,8 @@ sub cloneDummy_Define($$) {
if($a[0] eq $a[2]); if($a[0] eq $a[2]);
my $hn = $hash->{NAME}; my $hn = $hash->{NAME};
$hash->{NOTIFYDEV} = '.*'; $hash->{NOTIFYDEV} = $a[2];
# $hash->{NOTIFYDEV} = $a[2]; $hash->{NOTIFYSTATE} = $a[3] if(defined($a[3]));
# $hash->{NOTIFYSTATE} = $a[3] if(defined($a[3]));
$attr{$hn}{stateFormat} = "_state" if(defined($a[3])); $attr{$hn}{stateFormat} = "_state" if(defined($a[3]));
readingsSingleUpdate($hash,'state','defined',1); readingsSingleUpdate($hash,'state','defined',1);
Log3($hash,4,"cloneDummy: $a[0] defined for source $a[2]"); Log3($hash,4,"cloneDummy: $a[0] defined for source $a[2]");
@ -79,8 +73,7 @@ sub cloneDummy_Notify($$) {
$hs = $hash->{NOTIFYSTATE}; $hs = $hash->{NOTIFYSTATE};
} }
CommandDeleteReading(undef,"$hn .*") if(AttrVal($hn,'deleteBeforeUpdate',0)); readingsSingleUpdate($hash,"state", "active",1);
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
for(my $i=0;$i<$max;$i++){ for(my $i=0;$i<$max;$i++){
@ -106,7 +99,7 @@ sub cloneDummy_Notify($$) {
} }
} }
# readingsEndUpdate($hash, 1); readingsEndUpdate($hash, 1);
return; return;
} }
@ -114,6 +107,7 @@ sub cloneDummy_Notify($$) {
1; 1;
=pod =pod
=item helper
=item summary clone a device and its readings =item summary clone a device and its readings
=item summary_DE klont ein device und seine readings =item summary_DE klont ein device und seine readings
=begin html =begin html
@ -167,9 +161,6 @@ sub cloneDummy_Notify($$) {
<li>cloneIgnore <li>cloneIgnore
<br>- comma separated list of readingnames that will NOT be generated.<br> <br>- comma separated list of readingnames that will NOT be generated.<br>
Usefull to prevent truncated readingnames coming from state events.</li> Usefull to prevent truncated readingnames coming from state events.</li>
<br>
<li>deleteBeforeUpdate<br>
If set to 1, all readings will be deleted befor update.</li>
<br> <br>
<li><a href="#readingFnAttributes">readingFnAttributes</a></li> <li><a href="#readingFnAttributes">readingFnAttributes</a></li>
</ul> </ul>
@ -238,9 +229,6 @@ sub cloneDummy_Notify($$) {
Eine durch Kommata getrennte Liste der readings, die cloneDummy nicht in eigene readings Eine durch Kommata getrennte Liste der readings, die cloneDummy nicht in eigene readings
umwandelt</li> umwandelt</li>
<br> <br>
<li>deleteBeforeUpdate<br>
Ist dieses Attribut auf 1 gesetzt, werden alle readings zuerst gelöscht, bevor neue Readings geschrieben werden.</li>
<br>
<li><a href="#readingFnAttributes">readingFnAttributes</a></li> <li><a href="#readingFnAttributes">readingFnAttributes</a></li>
</ul> </ul>
<br> <br>