From 287c6ab7ea09bbae3477005f396630e788b1ad47 Mon Sep 17 00:00:00 2001 From: betateilchen Date: Tue, 30 Sep 2014 15:33:13 +0000 Subject: [PATCH] configDB: support for device specific userattr git-svn-id: https://svn.fhem.de/fhem/trunk@6636 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/configDB.pm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/fhem/configDB.pm b/fhem/configDB.pm index afab670cf..bc5d70eee 100644 --- a/fhem/configDB.pm +++ b/fhem/configDB.pm @@ -85,6 +85,8 @@ # # 2014-08-22 - added automatic fileimport during migration # +# 2014-09-30 - added support for device based userattr +# ############################################################################## # @@ -363,13 +365,26 @@ sub cfgDB_SaveCfg() { push @rowList, "define $d $defs{$d}{TYPE} $def"; } - foreach my $a (sort keys %{$attr{$d}}) { + foreach my $a (sort { + return -1 if($a eq "userattr"); # userattr must be first + return 1 if($b eq "userattr"); + return $a cmp $b; + } keys %{$attr{$d}}) { next if($d eq "global" && ($a eq "configfile" || $a eq "version")); my $val = $attr{$d}{$a}; $val =~ s/;/;;/g; push @rowList, "attr $d $a $val"; } + +# foreach my $a (sort keys %{$attr{$d}}) { +# next if($d eq "global" && +# ($a eq "configfile" || $a eq "version")); +# my $val = $attr{$d}{$a}; +# $val =~ s/;/;;/g; +# push @rowList, "attr $d $a $val"; +# } + } foreach my $a (sort keys %{$attr{configdb}}) {