diff --git a/fhem/FHEM/70_XBMC.pm b/fhem/FHEM/70_XBMC.pm index bf5c548cb..f5b40d845 100644 --- a/fhem/FHEM/70_XBMC.pm +++ b/fhem/FHEM/70_XBMC.pm @@ -29,7 +29,7 @@ sub XBMC_Initialize($$) $hash->{ReadFn} = "XBMC_Read"; $hash->{ReadyFn} = "XBMC_Ready"; $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_layout}{XBMC_RClayout} = "XBMC_RClayout"; @@ -79,14 +79,10 @@ 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 :"; - } + my $attrName = $power ? "powerCmdOn" : "powerCmdOff"; + my $cmdToExec = AttrVal($hash->{NAME}, $attrName, ''); - my $cmdToExec = $power ? $cmds[0] : $cmds[1]; - - return "Skipping empty command" if (length($cmdToExec) == 0); + return "Error: Attribute $attrName not set!" if (length($cmdToExec) == 0); # execute the power command fhem($cmdToExec); @@ -1405,8 +1401,8 @@ sub XBMC_HTTP_Request($$@)
  • hibernate - the XBMC host will be put into hibernation
  • reboot - the XBMC host will be rebooted
  • connect - try to connect to the XBMC host immediately
  • -
  • poweron - executes power-on command provided by the attribute powerCmd
  • -
  • poweroff - executes power-off command provided by the attribute powerCmd
  • +
  • poweron - executes power on command provided by the attribute powerCmd
  • +
  • poweroff - executes power off command provided by the attribute powerCmd


  • @@ -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 TCP was used). If you encounter problems like FHEM not responding for a few seconds then you should set attr <XBMC_device> fork enable which will move the search for XBMC into a separate process. +
  • powerCmdOn
    + Custom FHEM command to be executed when setting poweron. Is meant to be used in conjuction with devStateIcon
  • +
  • powerCmdOff
    + Custom FHEM command to be executed when setting poweroff. Is meant to be used in conjuction with devStateIcon