2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

70_XBMC: Splitted attribute powerCmd in powerCmdOn and powerCmdOff

git-svn-id: https://svn.fhem.de/fhem/trunk@7610 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
vbs2 2015-01-17 22:10:48 +00:00
parent 7fbae0b2f4
commit ea8ad43029

View File

@ -29,7 +29,7 @@ sub XBMC_Initialize($$)
$hash->{ReadFn} = "XBMC_Read"; $hash->{ReadFn} = "XBMC_Read";
$hash->{ReadyFn} = "XBMC_Ready"; $hash->{ReadyFn} = "XBMC_Ready";
$hash->{UndefFn} = "XBMC_Undefine"; $hash->{UndefFn} = "XBMC_Undefine";
$hash->{AttrList} = "fork:enable,disable compatibilityMode:xbmc,plex offMode:quit,hibernate,shutdown,standby pingInterval powerCmd " . $readingFnAttributes; $hash->{AttrList} = "fork:enable,disable compatibilityMode:xbmc,plex offMode:quit,hibernate,shutdown,standby pingInterval powerCmdOn powerCmdOff " . $readingFnAttributes;
$data{RC_makenotify}{XBMC} = "XBMC_RCmakenotify"; $data{RC_makenotify}{XBMC} = "XBMC_RCmakenotify";
$data{RC_layout}{XBMC_RClayout} = "XBMC_RClayout"; $data{RC_layout}{XBMC_RClayout} = "XBMC_RClayout";
@ -79,14 +79,10 @@ sub XBMC_PowerCmd($$)
{ {
my ($hash, $power) = @_; my ($hash, $power) = @_;
my @cmds = split ":", AttrVal($hash->{NAME},'powerCmd',''); my $attrName = $power ? "powerCmdOn" : "powerCmdOff";
if (scalar(@cmds) != 2) { my $cmdToExec = AttrVal($hash->{NAME}, $attrName, '');
return "Attribute powerCmd has an invalid format. Use <powerOnCmd>:<powerOffCmd>";
}
my $cmdToExec = $power ? $cmds[0] : $cmds[1]; return "Error: Attribute $attrName not set!" if (length($cmdToExec) == 0);
return "Skipping empty command" if (length($cmdToExec) == 0);
# execute the power command # execute the power command
fhem($cmdToExec); fhem($cmdToExec);
@ -1405,8 +1401,8 @@ sub XBMC_HTTP_Request($$@)
<li><b>hibernate</b> - the XBMC host will be put into hibernation</li> <li><b>hibernate</b> - the XBMC host will be put into hibernation</li>
<li><b>reboot</b> - the XBMC host will be rebooted</li> <li><b>reboot</b> - the XBMC host will be rebooted</li>
<li><b>connect</b> - try to connect to the XBMC host immediately</li> <li><b>connect</b> - try to connect to the XBMC host immediately</li>
<li><b>poweron</b> - executes power-on command provided by the attribute powerCmd</li> <li><b>poweron</b> - executes power on command provided by the attribute powerCmd</li>
<li><b>poweroff</b> - executes power-off command provided by the attribute powerCmd</li> <li><b>poweroff</b> - executes power off command provided by the attribute powerCmd</li>
</ul> </ul>
</ul> </ul>
<br><br> <br><br>
@ -1483,6 +1479,10 @@ sub XBMC_HTTP_Request($$@)
If XBMC does not run all the time it used to be the case that FHEM blocks because it cannot reach XBMC (only happened If XBMC does not run all the time it used to be the case that FHEM blocks because it cannot reach XBMC (only happened
if TCP was used). If you encounter problems like FHEM not responding for a few seconds then you should set <code>attr &lt;XBMC_device&gt; fork enable</code> if TCP was used). If you encounter problems like FHEM not responding for a few seconds then you should set <code>attr &lt;XBMC_device&gt; fork enable</code>
which will move the search for XBMC into a separate process.</li> which will move the search for XBMC into a separate process.</li>
<li>powerCmdOn<br>
Custom FHEM command to be executed when setting poweron. Is meant to be used in conjuction with devStateIcon</li>
<li>powerCmdOff<br>
Custom FHEM command to be executed when setting poweroff. Is meant to be used in conjuction with devStateIcon</li>
</ul> </ul>
</ul> </ul>