From 253afad710f4c8bac5f08a842e14dc4adf74f1fb Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Thu, 20 Dec 2012 09:52:02 -0800 Subject: [PATCH] Fix for Issue #26 Previously, insteon cleanup messages received by MH, would cause MH to clear the active message withoug confirming if the cleanup message corresponded to the active message. If multiple PLM scenes were sent sequentially, a cleanup message from one scene may have caused MH to clear out the following scenes command. This patch only clears the active message if the cleanup message matches the active message. --- lib/Insteon/BaseInterface.pm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/Insteon/BaseInterface.pm b/lib/Insteon/BaseInterface.pm index 01b324a6d..895e2da02 100755 --- a/lib/Insteon/BaseInterface.pm +++ b/lib/Insteon/BaseInterface.pm @@ -386,7 +386,20 @@ sub on_standard_insteon_received $self->transmit_in_progress(1); # ask the object to process the received message and update its state $object->_process_message($self, %cleanup_msg); - $self->clear_active_message(); + # Only clear active message if the cleanup received is really meant for the active message + if (($msg{extra} == $self->active_message->setby->group) + && ($object->message_type($msg{cmd_code}) eq $self->active_message->command)){ + $self->clear_active_message(); + &main::print_log("[Insteon::BaseInterface] DEBUG3: Cleanup message received, " + . "matched active message, cleared the active message") if $main::Debug{insteon} >= 3; + } + else { + &main::print_log("[Insteon::BaseInterface] DEBUG3: Cleanup message received, but " + . "active message not cleared b/c group/command in recent message " + . $msg{extra}."/".$object->message_type($msg{cmd_code}). " did not match group in " + . "prior sent message group/command " . $self->active_message->setby->group + ."/".$self->active_message->command) if $main::Debug{insteon} >= 3; + } } else { @@ -512,4 +525,4 @@ sub _aldb } -1 \ No newline at end of file +1