Skip to content

Commit

Permalink
Merge pull request #143 from krkeegan/insteon_fix_level_errors
Browse files Browse the repository at this point in the history
Insteon: Prevent Calling Level Command if Device Cannot Level
  • Loading branch information
krkeegan committed Mar 26, 2013
2 parents f61a1b3 + 1664f24 commit 92421bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Insteon/BaseInsteon.pm
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ sub set
$$self{pending_setby} = $p_setby;
$$self{pending_response} = $p_response;
}
$self->level($p_state) if $self->isa("Insteon::BaseDevice"); # update the level value
$self->level($p_state) if ($self->isa("Insteon::BaseDevice") && $self->can('level')); # update the level value
# $self->SUPER::set($p_state,$p_setby,$p_response) if defined $p_state;
} else {
&::print_log("[Insteon::BaseObject] failed state validation with state=$p_state");
Expand Down Expand Up @@ -444,7 +444,7 @@ sub _is_info_request
&::print_log("[Insteon::BaseObject] received status for " .
$self->{object_name} . " with on-level: $ack_on_level%, "
. "hops left: $msg{hopsleft}") if $main::Debug{insteon};
$self->level($ack_on_level); # update the level value
$self->level($ack_on_level) if $self->can('level'); # update the level value
if ($ack_on_level == 0) {
$self->SUPER::set('off', $ack_setby);
} elsif ($ack_on_level > 0 and !($self->isa('Insteon::DimmableLight'))) {
Expand Down

0 comments on commit 92421bc

Please sign in to comment.