Insteon: Fix Bug in PLM Sanity Check Which Caused Crash on X10 Messages

Fix issue identified by Marc

http://misterhouse.10964.n7.nabble.com/Insteon-IOLinc-Support-Draft-Done-tp17944p17950.html
Insteon: Clear No_Hop_Flag Even If No Debug; Don't Call Setby if Undef

Fixes errors pointed out by CDragon and MStovenour
Insteon: Fix Error in PLM Message Integrity Check Logic

Fix bugs in which PLM commands with a letter were rejected as being too long. Notably this prevented the scanning of the PLM link table.

Also fix bug which prevented MH from sending extended length messages to the PLM.

Fixes Issues
hollie/misterhouse#170
mstovenour/misterhouse#14
Merge pull request #171 from krkeegan/fix_issue_83

Insteon: Fix Error in PLM Message Integrity Check Logic
Insteon: Catch and Log AllLink_Cleanup_Reports

Fix bug in which MH set the state of a device to 'link_cleanup_report.'
Log the results of the cleanup reports.

Fixes Issue hollie/misterhouse#168
Insteon: Catch Error if Device ID in All_Link_Failure Does Not Exist

Checks to make sure an object exists, if no object exists for that device_id then it sends a message to the log reminding the user to delete_orphan links.

Fixes mstovenour/misterhouse#17
Insteon: Add Function to Filter Out Duplicate Received Messages

This creates a log of recently received messages with a timestamp.  Subsequent messages are check to see if they match.  If a match is found and if they message was received within the time permitted by the number of remaining hops plus a little wiggle room, the message is dropped.

Fixes issue hollie/misterhouse#169
Insteon: Update PLM Scene State on Change

When a PLM Scene is successfully sent, MH will now update the state of the scene.

Fixes issue hollie/misterhouse#177
Insteon: Extend Temporal Search Window for Duplicate Messages

Apparently the prior settings were not catching duplicative device commands.  Unfortunately extending the window results in numerous false positives for direct ACK messages.  In order to prevent errors, only alllink related commands are examined for duplicative messages.
Insteon: Expand Duplicate Window for Messages Requiring an ACK

Move function which prevented sequential set commands in less than 1 second to BaseObject

Expand the logic of the duplicate message checker.  Attempt to take into account whether the message received requires an ACK.  If an ACK is required, attempt to catch duplicate messages which result from the failure of the device to receive the ACK.
Insteon: Fix typo in _is_duplicate_received
Insteon: More Adjustments to is_duplicate_received

The message window is now calculated based on some basis in reality.  The message window is the amount of time during which no proper message should be received.

This depends on whether the message needs to be ACKed or not.

If a message needs to be ACKed, then no message should be received from the device until:
- All hops left expire
- Max hops + 1 elapses for an ACK to be received
- Max hops - less hops left for a new request to be sent

If no ACK is required then no message should be received from the device until:
-All hops left expire
-Max hops for a PLM message to be received by the device
(since MH is more sensitive to false positives in these types of messages, and since when duplicates occur here they normally occur very fast, we are more conservative for these types of messages)
Insteon: Add Time to Allow for ACK to Finish Transmitting

MH already pauses to all hops_left time to expire.

This adds a pause for messages that require ACKs to be sent to devices.  MH doesn't send the ACKs, they are automatically sent by the PLM.  However, anecdotal evidence suggests that the PLM doesn't abide by collision avoidance, ie it seems to permit a message to be sent immediately after an ACK without concern for allowing the ACK hops to complete.
Insteon: Catch Multiple Calls to Set_Receive in the Same Pass

Resolves one of the three loopholes discovered by @peloy which permitted duplicate messages received in the same pass to be processed.

Hopefully the final fix for hollie/misterhouse#169
Insteon: Catch Cleanup Messages Sent in the Same Pass as AllLink Messages

Issue discovered by @peloy.  MH should be ignoring the cleanup message received after an AllLink message.  However, both messages were previously processed if they were received in the same pass.  This resolves that discrepancy by checking what the state of the object will be at the start of the next pass.

Partially fixes hollie/misterhouse#185
Insteon: Log Output if PLM Parser Drops a Duplicate Message

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/misterhouse#186
Insteon: Relocate PLM Decoder to Allow Decoding Multiple Messages Received 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/misterhouse#186
Return a web page instead of HTML code when visiting Phone
Calls/VoiceMail Msgs -> Phone List (starting at the top IA5 page).
Insteon: Move Failure_Reason into BaseObject from Message

The active_message must be cleared before calling the failure_callback, otherwise we get into a strange loop with sync and scan links
Once the active_message is cleared, we lose our ability to keep track of the failured message and corresponding failure_reason

To resolve this, moved failure_reason from the message object into BaseObject.
Merge pull request #166 from krkeegan/hop_tracking

Insteon: Clear No_Hop_Flag Even If No Debug; Don't Call Setby if Undef