2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

37_harmony.pm: added set inactive/active command, fixed uninitialized value bug

git-svn-id: https://svn.fhem.de/fhem/trunk@15393 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2017-11-05 11:06:17 +00:00
parent 6bdb03cae9
commit ba36168886
2 changed files with 28 additions and 5 deletions

View File

@ -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<classname>@, improved matching for a numeric sequence

View File

@ -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, "<oa xmlns='connect.logitech.com' mime='vnd.logtech.setup/vnd.logitech.firmware?check' token=''>format=json</oa>");
#harmony_sendIq($hash, "<oa xmlns='connect.logitech.com' mime='vnd.logtech.setup/vnd.logitech.firmware?status' token=''>format=json</oa>");
@ -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.</li>
<li>update<br>
triggers a firmware update. only available if a new firmware is available.</li>
<li>inactive<br>
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.<br>
this command is intended to be used by scripts to temporarily
deactivate the harmony device.<br>
the concurrent setting of the disable attribute is not recommended.</li>
<li>active<br>
activates the current device (see inactive).</li>
</ul>
The command, hidDevice, text, cursor and special commmands are also available for the autocreated devices. The &lt;id&gt;|&ltname&gt; paramter hast to be omitted.<br><br>