Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insteon: PLM Parser Should: 1 Log Dropped Messages and 2 Decode All Messages #186

Closed
krkeegan opened this issue May 15, 2013 · 2 comments
Closed

Comments

@krkeegan
Copy link
Collaborator

Two issues:

  1. Insteon_PLM silently dumps identical consecutive messages received in the same pass (see around line 600). If possible a log message should be made when this occurs. There is a potential, that given how the parser functions, that this may not be possible.
  2. If multiple messages are received in the same line, the level 4 message decoder only processes the first message. This is not ideal. The decoder should decode all messages.
@peloy
Copy link
Collaborator

peloy commented May 15, 2013

Hi Kevin,

On 05/15/2013 02:11 PM, Kevin Robert Keegan wrote:

Two issues:

  1. Insteon_PLM silently dumps identical consecutive messages received in
    the same pass (see around line 600). If possible a log message should be
    made when this occurs. There is a potential, that given how the parser
    functions, that this may not be possible.

I am wondering about your last comment regarding possibility of doing
this... what do you have in mind that I am missing?

The obvious approach to producing a log message for this situation (my
dumb patch below) seems to be working for me:

05/15/13 03:21:20 PM [Insteon_PLM] DEBUG3: Received PLM raw data:
02501419e9000001cb110102501419e9000001cb1101
05/15/13 03:21:20 PM [Insteon_PLM] DEBUG4: Milliseconds 900.35
PLM Command: (0250) insteon_received
From Address: 14:19:e9
To Address: 00:00:01
Message Flags: cb
Message Type: (110) All-Link Broadcast Message
Message Length: (0) Standard Length
Hops Left: 2
Max Hops: 3
Insteon Message: 1101
Cmd 1: (11) ALL-Link Recall
Cmd 2: 01

05/15/13 03:21:20 PM [Insteon::BaseInterface] DEBUG3: Message received
with 2 hops left, delaying next transmit by 250 milliseconds to avoid c
ollisions.
05/15/13 03:21:20 PM [Insteon::BaseInterface] Received message from:
$garage_motion; command: on; type: alllink; group: 01
05/15/13 03:21:20 PM [Insteon::BaseObject] DEBUG3: Adding hop count of 1
to hop_array of $garage_motion
05/15/13 03:21:20 PM [Insteon::MotionSensor]
$garage_motion::set_receive(on, $garage_motion)
05/15/13 03:21:20 PM [Insteon_PLM] DEBUG4: New parsed data
(02501419e9000001cb1101) is the same as the previous parsed data;
assuming a duplicate message and ignoring new parsed data.

I guess another approach is to not do anything here and let the new
duplicate-catching infrastructure make the catch later when it runs, but
it seems to me like we have nothing to lose (and performance to gain) by
dropping the duplicate here.

Cheers,

Eloy Paris.-


--- a/lib/Insteon_PLM.pm
+++ b/lib/Insteon_PLM.pm
@@ -598,7 +598,15 @@ sub _parse_data {
{
#ignore blanks.. the split does odd things
next if $parsed_data eq '';

  •            next if $previous_parsed_data eq $parsed_data; # guard 
    
    against repeats
  •           if ($previous_parsed_data eq $parsed_data)
    
  •           {
    
  •               # guard against repeats
    
  •               &::print_log("[Insteon_PLM] DEBUG4: New parsed data ("
    
  •                            . "$parsed_data) is the same as the 
    
    previous "
  •                            . "parsed data; assuming a duplicate 
    
    message "
  •                            . "and ignoring new parsed data.") if 
    
    $main::Debug{insteon} >= 4;
  •               next;
    
  •           }
              $previous_parsed_data = $parsed_data; # and, now 
    
    reinitialize

@krkeegan
Copy link
Collaborator Author

The parsing function is somewhat bizarre and is not a type of coding I had ever seen before. I say that it might not be possible, because I wonder if the parser itself actually makes duplicate messages and that by adding a log message we would end up with a lot of false positive log messages.

I am doing a poor job of explaining this, a quick test will certainly determine whether it would work or not.

krkeegan added a commit to krkeegan/misterhouse that referenced this issue May 17, 2013
As discovered by @peloy, the PLM Parser was silently dropping duplicate messages sequentially received in the same pass.

This adds a debug3 message to the log when such messages are dropped.

Partial fix for hollie#186
krkeegan added a commit to krkeegan/misterhouse that referenced this issue May 17, 2013
…eived at the Same Time

PLM Decoder will not decode each message if multiple are received in one check data request.

The only place that could create a hiccup, is if the PLM Parser has a bug.  Since we now rely on the PLM Parser to first identify a valid message before asking the decoder to decode it, we rely on the PLM Parser to accurately discover messages.

We still display the raw message, so the information is not lost, but we will not have a nice display of the message.  I don't see this as a big deal, if the PLM Parser is missing messages we would likely have other problems anyways.

Fixes the remainder of hollie#186
krkeegan added a commit to krkeegan/misterhouse that referenced this issue May 22, 2013
Message decoder only decodes the first message it finds
So to decode all messages, we need to send it the parsed_data

Closed hollie#186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants