read devices-local.xml in addition to devices.xml

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@5677 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme1968
2014-04-27 10:28:47 +00:00
parent d1457be59d
commit 25ce718e08

View File

@@ -99,12 +99,25 @@ SWAP_loadDevices()
my $_products = {};
my $file_name = "$attr{global}{modpath}/FHEM/lib/SWAP/devices.xml";
if( ! -e $file_name ){
if( !SWAP_loadDevicesHelper( $file_name, $_developers, $_products ) ) {
Log3 undef, 2, "could not read $file_name";
return ($_developers,$_products);
}
$file_name = "$attr{global}{modpath}/FHEM/lib/SWAP/devices-local.xml";
if( !SWAP_loadDevicesHelper( $file_name, $_developers, $_products ) ) {
Log3 undef, 4, "could not read $file_name";
}
return ($_developers,$_products);
}
sub
SWAP_loadDevicesHelper($$$)
{
my ($file_name, $_developers, $_products) = @_;
return 0 if( ! -e $file_name );
my $developers = XMLin($file_name, KeyAttr => { }, ForceArray => [ 'dev' ]);
foreach my $developer (@{$developers->{developer}}){
@@ -126,7 +139,7 @@ SWAP_loadDevices()
}
}
return ($_developers,$_products);
return 1;
}
sub
readDeviceXML($$)