mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-17 23:46:03 +00:00
read devices-local.xml in addition to devices.xml
git-svn-id: https://svn.fhem.de/fhem/trunk@5677 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
82bbfe606a
commit
1c0da3d1a6
@ -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($$)
|
||||
|
Loading…
x
Reference in New Issue
Block a user