2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-26 10:34:52 +00:00

AndroidDB: added attribute presetFile

git-svn-id: https://svn.fhem.de/fhem/trunk@25626 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
zap 2022-02-04 14:37:05 +00:00
parent 929e3fc648
commit 308643471c
3 changed files with 15 additions and 9 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it. # Do not insert empty lines here, update check depends on it.
- feature: 89_AndroidDB: added attribute presetFile
- bugfix: 70_ESCVP21net.pm: fix perl warning, set standard port - bugfix: 70_ESCVP21net.pm: fix perl warning, set standard port
- feature: 88_HMCCU.pm: Optimized RPC requests - feature: 88_HMCCU.pm: Optimized RPC requests
- feature: 30_HUEBridge: added get v2effects & set v2json - feature: 30_HUEBridge: added get v2effects & set v2json

View File

@ -4,7 +4,7 @@
# #
# 89_AndroidDB # 89_AndroidDB
# #
# Version 0.3 # Version 0.4
# #
# FHEM Integration for Android Devices # FHEM Integration for Android Devices
# #
@ -36,7 +36,7 @@ sub AndroidDB_Initialize ($)
$hash->{ShutdownFn} = "AndroidDB::Shutdown"; $hash->{ShutdownFn} = "AndroidDB::Shutdown";
$hash->{parseParams} = 1; $hash->{parseParams} = 1;
$hash->{AttrList} = 'macros:textField-long preset:MagentaTVStick,SonyTV'; $hash->{AttrList} = 'macros:textField-long preset:MagentaTVStick,SonyTV presetFile';
} }
package AndroidDB; package AndroidDB;
@ -195,9 +195,10 @@ sub Attr ($@)
$PRESET{_custom_}{$macroName} = $macroKeycodes; $PRESET{_custom_}{$macroName} = $macroKeycodes;
} }
} }
elsif ($attrName eq 'preset' && $attrVal =~ /^\@(.+)$/) { elsif ($attrName eq 'presetFile') {
if (!LoadPreset ($hash, $1)) { if (!LoadPreset ($hash, $attrVal)) {
Log3 $hash, 2, "Can't load preset from file $1"; Log3 $hash, 2, "Can't load preset from file $attrVal";
return "Cannot load preset from file $attrVal";
} }
} }
} }
@ -306,9 +307,13 @@ sub LoadPreset ($$)
Several macro definitions can be specified by seperating them using a blank character. Several macro definitions can be specified by seperating them using a blank character.
</li><br/> </li><br/>
<a name="preset"></a> <a name="preset"></a>
<li><b>preset {&lt;PresetName&gt;|@&lt;PresetFileName&gt;}</b><br/> <li><b>preset &lt;PresetName&gt;</b><br/>
Select a preset of keycode macros or load a set of macros from a preset defintion Select a preset of keycode macros.
file. If the same macro name is defined in the selected </li><br/>
<a name="presetFile"></a>
<li><b>presetFile &lt;Filename&gt;</b><br/>
Load a set of macros from a preset defintion file.
If the same macro name is defined in the selected
preset and in attribute 'macros', the definition in the 'macros' attribute overwrites preset and in attribute 'macros', the definition in the 'macros' attribute overwrites
the definition in the preset.<br/> the definition in the preset.<br/>
A preset defintion file is using the following format:<br/> A preset defintion file is using the following format:<br/>

View File

@ -45,7 +45,7 @@ package AndroidDBHost;
use strict; use strict;
use warnings; use warnings;
use Data::Dumper; # use Data::Dumper;
use IPC::Open3; use IPC::Open3;
use SetExtensions; use SetExtensions;