2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 16:56:04 +00:00

configDB: support for device specific userattr

git-svn-id: https://svn.fhem.de/fhem/trunk@6636 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2014-09-30 15:33:13 +00:00
parent b8ec728793
commit a8706c2206

View File

@ -85,6 +85,8 @@
# #
# 2014-08-22 - added automatic fileimport during migration # 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"; 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" && next if($d eq "global" &&
($a eq "configfile" || $a eq "version")); ($a eq "configfile" || $a eq "version"));
my $val = $attr{$d}{$a}; my $val = $attr{$d}{$a};
$val =~ s/;/;;/g; $val =~ s/;/;;/g;
push @rowList, "attr $d $a $val"; 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}}) { foreach my $a (sort keys %{$attr{configdb}}) {