From 253afad710f4c8bac5f08a842e14dc4adf74f1fb Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Thu, 20 Dec 2012 09:52:02 -0800 Subject: [PATCH 1/5] 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 From 2e25477cc68f6fdd1ce42ad16fb41682f6ea5ddd Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Thu, 20 Dec 2012 10:26:50 -0800 Subject: [PATCH 2/5] Fix for Issue #27 Add a conditional check for the file 1100tags.txt. If it doesn't exist in the user defined data directory, then default to the Pgm_root/data directory. --- web/bin/tagline.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/bin/tagline.pl b/web/bin/tagline.pl index 51a35951e..5584744bb 100644 --- a/web/bin/tagline.pl +++ b/web/bin/tagline.pl @@ -3,7 +3,12 @@ # Authority: anyone -@ARGV = "$config_parms{data_dir}/remarks/1100tags.txt"; +if (-e "$config_parms{data_dir}/remarks/1100tags.txt"){ + @ARGV = "$config_parms{data_dir}/remarks/1100tags.txt"; +} +else{ + @ARGV = "$Pgm_Root/data/remarks/1100tags.txt"; +} my $tagline; rand($.) < 1 && ($tagline=$_) while <>; From 10c4be9a1aff75f1a72c94a026b64c58310b3240 Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Thu, 20 Dec 2012 10:35:31 -0800 Subject: [PATCH 3/5] Update debug to note I2CS devices as potential sources of error An I2CS device will respond with a NACK if you try and control it with the PLM before it is linked as a responder. Add a note to the debug log regarding this. --- lib/Insteon/BaseInsteon.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Insteon/BaseInsteon.pm b/lib/Insteon/BaseInsteon.pm index 6e7e34ee1..711404983 100755 --- a/lib/Insteon/BaseInsteon.pm +++ b/lib/Insteon/BaseInsteon.pm @@ -530,7 +530,7 @@ sub _process_message . $self->get_nack_msg_for( $msg{extra} ) .") for " . $self->{object_name} - . ". It may be unplugged or have a burned out bulb") if $main::Debug{insteon}; + . ". It may be unplugged or have a burned out bulb or this may be a new I2CS type device.") if $main::Debug{insteon}; } else { &::print_log("[Insteon::BaseObject] WARN!! encountered a nack message (" From 27554a1c74a74993d98f5a54103f17f3b97afcde Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Thu, 20 Dec 2012 17:23:49 -0800 Subject: [PATCH 4/5] Partial Fix for #28 Based on Marc Merlin's code, I confirmed that I received the same error. More issues with #28 still need to be solved. --- lib/Insteon/AllLinkDatabase.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Insteon/AllLinkDatabase.pm b/lib/Insteon/AllLinkDatabase.pm index 31d67c0de..6ebea914b 100755 --- a/lib/Insteon/AllLinkDatabase.pm +++ b/lib/Insteon/AllLinkDatabase.pm @@ -1219,7 +1219,7 @@ sub add_duplicate_link_address sub delete_duplicate_link_address { my ($self, $address) = @_; - my $num_duplicate_link_addresses = @{$$self{aldb}{duplicates}}; + my $num_duplicate_link_addresses = (defined $$self{aldb}{duplicates}) ? @{$$self{aldb}{duplicates}} : 0; if ($num_duplicate_link_addresses) { my @temp_duplicates = (); @@ -1239,7 +1239,7 @@ sub add_empty_address { my ($self, $address) = @_; # before adding it, make sure that it isn't already in the list!! - my $num_addresses = @{$$self{aldb}{empty}}; + my $num_addresses = (defined $$self{aldb}{empty}) ? @{$$self{aldb}{empty}} : 0; my $exists = 0; if ($num_addresses and $address) { From 057de7639fbb8943a0b424d845895e15ca21c2b9 Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Sat, 22 Dec 2012 09:21:42 -0800 Subject: [PATCH 5/5] Fix typos in AllLinkDatabase These are likely causing some unnoticed error. --- lib/Insteon/AllLinkDatabase.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Insteon/AllLinkDatabase.pm b/lib/Insteon/AllLinkDatabase.pm index 6ebea914b..5df03e15d 100755 --- a/lib/Insteon/AllLinkDatabase.pm +++ b/lib/Insteon/AllLinkDatabase.pm @@ -796,7 +796,7 @@ sub delete_orphan_links : &Insteon::get_object($deviceid,'01'); if (!($linked_device)) { - # no device is known by mh with the ADLB record's deviceid + # no device is known by mh with the ALDB record's deviceid if ($audit_mode) { &::print_log("[Insteon::ALDB_i1] (AUDIT) " . $selfname . " now deleting orphaned link w/ details: " @@ -1212,7 +1212,7 @@ sub add_duplicate_link_address unshift @{$$self{aldb}{duplicates}}, $address; # now, keep the list sorted! - @{$$self{adlb}{duplicates}} = sort(@{$$self{aldb}{duplicates}}); + @{$$self{aldb}{duplicates}} = sort(@{$$self{aldb}{duplicates}}); } @@ -1259,7 +1259,7 @@ sub add_empty_address } # now, keep the list sorted! - @{$$self{adlb}{empty}} = sort(@{$$self{aldb}{empty}}); + @{$$self{aldb}{empty}} = sort(@{$$self{aldb}{empty}}); }