From b07628aca845de9bbb5332b97a9e4e096a406ad1 Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Thu, 18 Apr 2013 20:15:25 -0700 Subject: [PATCH 1/4] Insteon: Add Parameter to Allow Per Device Min/Max Hop Setting --- lib/Insteon/BaseInsteon.pm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/Insteon/BaseInsteon.pm b/lib/Insteon/BaseInsteon.pm index 4ec80281f..51a3d5107 100755 --- a/lib/Insteon/BaseInsteon.pm +++ b/lib/Insteon/BaseInsteon.pm @@ -24,6 +24,7 @@ Special Thanks to: Bruce Winter - MH @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +=over =cut package Insteon::BaseObject; @@ -155,6 +156,28 @@ sub group return $$self{m_group}; } +=item C + +Sets the maximum number of hops that may be used in a message sent to the device. +The default and maximum number is 3. $int is an integer between 0-3. +=cut +sub max_hops { + my ($self, $hops) = @_; + $$self{max_hops} = $hops if $hops; + return $$self{max_hops}; +} + +=item C + +Sets the minimum number of hops that may be used in a message sent to the device. +The default and minimum number is 0. $int is an integer between 0-3. +=cut +sub min_hops { + my ($self, $hops) = @_; + $$self{min_hops} = $hops if $hops; + return $$self{min_hops}; +} + sub default_hop_count { my ($self, $hop_count) = @_; @@ -170,6 +193,10 @@ sub default_hop_count $high = $_ if ($high < $_);; } $$self{default_hop_count} = $high; + $$self{default_hop_count} = $$self{max_hops} if ($$self{max_hops} && + $$self{default_hop_count} > $$self{max_hops}); + $$self{default_hop_count} = $$self{min_hops} if ($$self{min_hops} && + $$self{default_hop_count} < $$self{min_hops}); return $$self{default_hop_count}; } @@ -1872,3 +1899,5 @@ sub is_root } 1; +=back +=cut From b93ddb0a4faf167e07a9d1d93f6877f80b7109fd Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Thu, 18 Apr 2013 20:15:25 -0700 Subject: [PATCH 2/4] Insteon: Fix Error in Logic Which Caused an Unnecessary Increase in Hop Count --- lib/Insteon/Message.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Insteon/Message.pm b/lib/Insteon/Message.pm index 841553322..f2b87ca18 100755 --- a/lib/Insteon/Message.pm +++ b/lib/Insteon/Message.pm @@ -410,7 +410,7 @@ sub _derive_interface_data } else { - my $hop_count = $self->send_attempts + $self->setby->default_hop_count - 1; + my $hop_count = $self->setby->default_hop_count; $cmd.=$self->setby->device_id(); if ($self->command_type =~ /insteon_ext_send/i) { From 09c5456d6f5705c9cc7f18f539f8c83f484e05cb Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Tue, 23 Jul 2013 15:44:52 -0700 Subject: [PATCH 3/4] Fix additional typos from manual merge --- lib/Insteon/BaseInsteon.pm | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/Insteon/BaseInsteon.pm b/lib/Insteon/BaseInsteon.pm index fbcd9fb6f..da30b099c 100644 --- a/lib/Insteon/BaseInsteon.pm +++ b/lib/Insteon/BaseInsteon.pm @@ -2998,5 +2998,3 @@ You should have received a copy of the GNU General Public License along with thi =cut 1; -=back -=cut From 4835bd9ef572a8abcf04c9a50a9935d6a6ed9053 Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Tue, 23 Jul 2013 16:37:39 -0700 Subject: [PATCH 4/4] Insteon: Max/Min Hops Setting Not Saved on Reboot --- lib/Insteon/BaseInsteon.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Insteon/BaseInsteon.pm b/lib/Insteon/BaseInsteon.pm index da30b099c..4b998e4f7 100644 --- a/lib/Insteon/BaseInsteon.pm +++ b/lib/Insteon/BaseInsteon.pm @@ -101,6 +101,8 @@ sub new $self->restore_data('default_hop_count', 'engine_version'); $self->initialize(); + $$self{max_hops} = 3; + $$self{min_hops} = 0; $$self{level} = undef; $$self{flag} = "0F"; $$self{ackMode} = "1"; @@ -200,6 +202,9 @@ sub group Sets the maximum number of hops that may be used in a message sent to the device. The default and maximum number is 3. $int is an integer between 0-3. + +This value is NOT saved on reboot, as such likely should be called in a $Reload loop. + =cut sub max_hops { @@ -212,6 +217,9 @@ sub max_hops { Sets the minimum number of hops that may be used in a message sent to the device. The default and minimum number is 0. $int is an integer between 0-3. + +This value is NOT saved on reboot, as such likely should be called in a $Reload loop. + =cut sub min_hops {