diff --git a/fhem/CHANGED b/fhem/CHANGED index b765d4161..826020ea0 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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. + - changed: 37_harmony: added set inactive/active commands - bugfix: 31_Nello: syntax error - feature: fhemweb_iconRadio.js: add a user defined class to svg icons by prefix class@, improved matching for a numeric sequence diff --git a/fhem/FHEM/37_harmony.pm b/fhem/FHEM/37_harmony.pm index 413317ff3..39e0af178 100644 --- a/fhem/FHEM/37_harmony.pm +++ b/fhem/FHEM/37_harmony.pm @@ -508,8 +508,8 @@ harmony_Set($$@) return undef; } elsif( $cmd eq "reconnect" ) { - delete $hash->{helper}{UserAuthToken} if( $param eq "all" ); - delete $hash->{identity} if( $param eq "all" ); + delete $hash->{helper}{UserAuthToken} if( $param && $param eq "all" ); + delete $hash->{identity} if( $param && $param eq "all" ); harmony_connect($hash); return undef; @@ -537,6 +537,19 @@ harmony_Set($$@) return undef; + } elsif( $cmd eq "active" ) { + return "can't activate disabled hub." if(AttrVal($name, "disable", undef)); + + $hash->{ConnectionState} = "Disconnected"; + readingsSingleUpdate( $hash, "state", $hash->{ConnectionState}, 1 ); + harmony_connect($hash); + return undef; + + } elsif( $cmd eq "inactive" ) { + harmony_disconnect($hash); + readingsSingleUpdate($hash, "state", "inactive", 1); + return undef; + } elsif( $cmd eq "xxx" ) { #harmony_sendIq($hash, "format=json"); #harmony_sendIq($hash, "format=json"); @@ -607,7 +620,7 @@ harmony_Set($$@) $list .= " channel" if( defined($hash->{currentActivityID}) && $hash->{currentActivityID} != -1 ); - $list .= " command getConfig:noArg getCurrentActivity:noArg off:noArg reconnect:noArg sleeptimer sync:noArg text cursor:up,down,left,right,pageUp,pageDown,home,end special:previousTrack,nextTrack,stop,playPause,volumeUp,volumeDown,mute"; + $list .= " command active:noArg inactive:noArg getConfig:noArg getCurrentActivity:noArg off:noArg reconnect:noArg sleeptimer sync:noArg text cursor:up,down,left,right,pageUp,pageDown,home,end special:previousTrack,nextTrack,stop,playPause,volumeUp,volumeDown,mute"; $list .= " update:noArg" if( $hash->{hubUpdate} ); @@ -1222,7 +1235,7 @@ harmony_connect($) my ($hash) = @_; my $name = $hash->{NAME}; - return if( AttrVal($hash->{NAME}, "disable", 0) ); + return if( IsDisabled($name) ); harmony_disconnect($hash); @@ -1407,7 +1420,7 @@ harmony_autocreate($;$) #foreach my $d (keys %defs) { # next if($defs{$d}{TYPE} ne "autocreate"); - # return undef if(AttrVal($defs{$d}{NAME},"disable",undef)); + # return undef if( IsDisabled($defs{$d}{NAME} ) ); #} my $autocreated = 0; @@ -1884,6 +1897,15 @@ harmony_decrypt($) of these devices will be updatet with the power state defined in these activites.
  • update
    triggers a firmware update. only available if a new firmware is available.
  • +
  • inactive
    + inactivates the current device. note the slight difference to the + disable attribute: using set inactive the state is automatically saved + to the statefile on shutdown, there is no explicit save necesary.
    + this command is intended to be used by scripts to temporarily + deactivate the harmony device.
    + the concurrent setting of the disable attribute is not recommended.
  • +
  • active
    + activates the current device (see inactive).
  • The command, hidDevice, text, cursor and special commmands are also available for the autocreated devices. The <id>|<name> paramter hast to be omitted.