mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-07 16:59:18 +00:00
70_XBMC: new commands poweron,poweroff. configurable by attribute powerCmd
git-svn-id: https://svn.fhem.de/fhem/trunk@7608 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
231c7bf5ff
commit
dab46798aa
@ -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: 70_XBMC.pm: new commands poweron,poweroff. configurable by attribute powerCmd
|
||||||
- added: 71_YAMAHA_NP.pm: New module for controlling Yamaha network players such as CRX-N560(D)
|
- added: 71_YAMAHA_NP.pm: New module for controlling Yamaha network players such as CRX-N560(D)
|
||||||
- bugfix: FB_CALLMONITOR: fix not working telnet login, when user based
|
- bugfix: FB_CALLMONITOR: fix not working telnet login, when user based
|
||||||
authentication is configured in FritzBox
|
authentication is configured in FritzBox
|
||||||
|
@ -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 " . $readingFnAttributes;
|
$hash->{AttrList} = "fork:enable,disable compatibilityMode:xbmc,plex offMode:quit,hibernate,shutdown,standby pingInterval powerCmd " . $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";
|
||||||
@ -75,6 +75,25 @@ sub XBMC_Define($$)
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub XBMC_PowerCmd($$)
|
||||||
|
{
|
||||||
|
my ($hash, $power) = @_;
|
||||||
|
|
||||||
|
my @cmds = split ":", AttrVal($hash->{NAME},'powerCmd','');
|
||||||
|
if (scalar(@cmds) != 2) {
|
||||||
|
return "Attribute powerCmd has an invalid format. Use <powerOnCmd>:<powerOffCmd>";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $cmdToExec = $power ? $cmds[0] : $cmds[1];
|
||||||
|
|
||||||
|
return "Skipping empty command" if (length($cmdToExec) == 0);
|
||||||
|
|
||||||
|
# execute the power command
|
||||||
|
fhem($cmdToExec);
|
||||||
|
|
||||||
|
return "Executed command: $cmdToExec";
|
||||||
|
}
|
||||||
|
|
||||||
# Force a connection attempt to XBMC as soon as possible
|
# Force a connection attempt to XBMC as soon as possible
|
||||||
# (e.g. you know you just started it and want to connect immediately without waiting up to 60 s)
|
# (e.g. you know you just started it and want to connect immediately without waiting up to 60 s)
|
||||||
sub XBMC_Connect($)
|
sub XBMC_Connect($)
|
||||||
@ -778,6 +797,12 @@ sub XBMC_Set($@)
|
|||||||
elsif($cmd eq 'connect') {
|
elsif($cmd eq 'connect') {
|
||||||
return XBMC_Connect($hash);
|
return XBMC_Connect($hash);
|
||||||
}
|
}
|
||||||
|
elsif($cmd eq 'poweron') {
|
||||||
|
return XBMC_PowerCmd($hash, 1);
|
||||||
|
}
|
||||||
|
elsif($cmd eq 'poweroff') {
|
||||||
|
return XBMC_PowerCmd($hash, 0);
|
||||||
|
}
|
||||||
my $res = "Unknown argument " . $cmd . ", choose one of " .
|
my $res = "Unknown argument " . $cmd . ", choose one of " .
|
||||||
"off play:all,audio,video,picture playpause:all,audio,video,picture pause:all,audio,video,picture " .
|
"off play:all,audio,video,picture playpause:all,audio,video,picture pause:all,audio,video,picture " .
|
||||||
"prev:all,audio,video,picture next:all,audio,video,picture goto stop:all,audio,video,picture " .
|
"prev:all,audio,video,picture next:all,audio,video,picture goto stop:all,audio,video,picture " .
|
||||||
@ -814,7 +839,7 @@ sub XBMC_Set($@)
|
|||||||
"mute:toggle,on,off volume:slider,0,1,100 quit:noArg " .
|
"mute:toggle,on,off volume:slider,0,1,100 quit:noArg " .
|
||||||
"eject:noArg hibernate:noArg reboot:noArg shutdown:noArg suspend:noArg " .
|
"eject:noArg hibernate:noArg reboot:noArg shutdown:noArg suspend:noArg " .
|
||||||
"videolibrary:scan,clean audiolibrary:scan,clean statusRequest jsonraw " .
|
"videolibrary:scan,clean audiolibrary:scan,clean statusRequest jsonraw " .
|
||||||
"connect";
|
"connect poweron poweroff";
|
||||||
return $res ;
|
return $res ;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1380,6 +1405,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>poweroff</b> - executes power-off command provided by the attribute powerCmd</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user