Merge pull request #171 from krkeegan/fix_issue_83

Insteon: Fix Error in PLM Message Integrity Check Logic
Merge branch 'master' into insteon_iolinc
Merge remote-tracking branch 'mstovenour/merge_i2_aldb_support' into insteon_iolinc

Conflicts:
	lib/Insteon/BaseInsteon.pm
Merge branch 'fix_issue_83' into insteon_iolinc
Insteon_FanLinc: Initial Code
Insteon_FanLinc: Add FanLinc to Read Table A
Insteon_FanLinc: Add Complex Set Routine for Fan

A little bit of rebuilding the wheel here.  There was no way to seperate out the set command in BaseObject to accomplish what we needed.
Insteon_FanLinc: Add Function to Catch and Process Ack for Fan

Again, a bit of rebuilding the wheel.  But need to catch a message destined for the parent item and use it to update the child.
Insteon_FanLinc: Fix Typo in Read Table A
Insteon_FanLinc: Fix Level Error in Child Set Command

Was incorrectly calling convert_level on a bad value
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_Remotelinc: Added Ability to Set Awake Time and To Request Battery Status

The following likely only works for i2cs devices, I think all Remotelinc 2 devices are i2cs?  It at least works on rev 1.4.

- set_awake_time sets = sets the time in seconds that the remote will remain awake after sending a command.  The default is 4, it can be set up to 254 seconds, with 255 being always awake.

- get_extended_info = is primarily added to get the battery level.  Battery level is returned as a byte, but the number does not immediately make sense.  I will have to let the batter run down some to better understand what it means.

At the moment, I have the code set to call get_extended_info whenever the all_link_report is received.  This report represents the last message sent by the device before the awake time begins to run.  In the future, an additional function can be added to only call get_extended_info if it hasn't been called in x hours.

N.B. in order for set_awake_time to work properly, the engine version of the device must be known.

hollie/misterhouse#172
Insteon_RemoteLinc: Add Perl Documentation
Insteon_RemoteLinc: Add Set Battery Timer
Insteon_RemoteLinc: Add Check for If Battery Timer Expired