Skip to content

Commit

Permalink
Insteon: Set Device State on a Received AllLink Broadcast Message
Browse files Browse the repository at this point in the history
Fixes issue hollie#153

The set routine is now called when a broadcase message is received.  The flag _pending_cleanup is also set.

When a Direct Cleanup Message is received, if the state of the device matches the pending state and the _pending_cleanup flag is set, we assume that this command was already processed.

This code is all adjacent to each other, so using a flag should not be confusing.

Much of the code was already there, but was commented out by Gregg in his first commit of the new insteon code.  This initial commit included a huge number of changes and no notes were added as to why this was disabled in the redux.
  • Loading branch information
krkeegan committed Apr 13, 2013
1 parent 22e04af commit 597ad5a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/Insteon/BaseInsteon.pm
Original file line number Diff line number Diff line change
Expand Up @@ -560,12 +560,17 @@ sub _process_message
$p_state = $msg{command};
if ($msg{type} eq 'alllink')
{
$self->set($p_state, $self);
$$self{_pending_cleanup} = 1;
}
elsif ($msg{type} eq 'cleanup')
{
$self->set($p_state, $self); # unless (lc($self->state) eq lc($p_state)) and
# ($msg{type} eq 'cleanup' and $$self{_pending_cleanup});
if (lc($self->state) eq lc($p_state) and $$self{_pending_cleanup}){
$self->set($p_state, $self);
} else {
::print_log("[Insteon::BaseObject] Ignoring Received Direct AllLink Cleanup Message for "
. $self->{object_name} . " since AllLink Broadcast Message was Received.") if $main::Debug{insteon};
}
$$self{_pending_cleanup} = 0;
} else {
main::print_log("[Insteon::BaseObject] Ignoring unsupported command from "
Expand Down

0 comments on commit 597ad5a

Please sign in to comment.