Skip to content

Commit

Permalink
Merge pull request hollie#386 from krkeegan/x10_retry
Browse files Browse the repository at this point in the history
X10: Retry if Message is Not Acked by PLM
  • Loading branch information
krkeegan committed Mar 26, 2014
2 parents 55554ea + 6d59fa4 commit 8307d23
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Insteon/BaseInterface.pm
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ sub process_queue
$failed_message->setby->fail_count_log(1)
if $failed_message->setby->can('fail_count_log');
}
else
elsif (!$failed_message->isa('Insteon::X10Message'))
{
&main::print_log("[Insteon::BaseInterface] WARN! Unable to clear acknowledge for "
. ((defined($failed_message->setby)) ? $failed_message->setby->get_object_name : "undefined"));
Expand Down
2 changes: 1 addition & 1 deletion lib/Insteon/Message.pm
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ sub send
if ($self->send_attempts > 0)
{
if ((ref $self->setby && $self->setby->debuglevel(1, 'insteon')) ||
((!ref $self->setby) && ::Debug{'insteon'})){
((!ref $self->setby) && $::Debug{'insteon'})){
::print_log("[Insteon::BaseMessage] WARN: now resending "
. $self->to_string() . " after " . $self->send_attempts
. " attempts.");
Expand Down
4 changes: 3 additions & 1 deletion lib/Insteon_PLM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ sub _send_cmd {
. sprintf('%.2f',$incurred_delay_time) . " seconds") if $self->debuglevel(2, 'insteon');
$command = $prefix{x10_send} . $command;
$delay = $$self{xmit_x10_delay};
$self->_set_timeout('command', '1000'); # a commmand needs to be PLM ack'd w/i 1 seconds or a retry is attempted
# clear command timeout so that we don't wait for an insteon ack before sending the next command
} else {
my $command_type = $message->command_type;
Expand All @@ -476,7 +477,7 @@ sub _send_cmd {
$command = $prefix{$command_type} . $command;
if ($command_type eq 'all_link_send' or $command_type eq 'insteon_send' or $command_type eq 'insteon_ext_send' or $command_type eq 'all_link_direct_cleanup')
{
$self->_set_timeout('command', $cmd_timeout); # a commmand needs to be PLM ack'd w/i 3 seconds or it gets dropped
$self->_set_timeout('command', $cmd_timeout); # a commmand needs to be ack'd by device w/i $cmd_timeout or a retry is attempted
}
}
my $is_extended = ($message->can('command_type') && $message->command_type eq "insteon_ext_send") ? 1 : 0;
Expand Down Expand Up @@ -622,6 +623,7 @@ sub _parse_data {
# AND if the current, pending message is the X10 message
if (($parsed_data =~ /$prefix{x10_send}\w{4}06/) && ($pending_message->isa('Insteon::X10Message')))
{
$self->_clear_timeout('command');
$self->clear_active_message();
}

Expand Down

0 comments on commit 8307d23

Please sign in to comment.