So that was easy enough.  A first draft of an All_link_scan that skips unchanged devices has been posted to my git repository.  This is extremely raw and all possible faults haven't been tested yet.

So far, it is awesome.  The ALDB_Delta number works as advertised on all of my devices.  If I make a change manually or from MH the ALDB_Delta number changes, signalling that a new scan needs to be made.  

If you want to test it out, to conduct a scan which will skip devices you need to run scan_all_linktables(1).  For each device a Status Request is made at the start of the scan.  If the ALDB Delta has not changed, MH skips scanning the device. If the ALDB Delta has changed MH will scan the entire device and store the new ALDB Delta record.  The Scan Link Table Voice Cmd for each device still forces a full scan of that device.  

I still have a lot of work to do and will add voice commands in a little bit.

I also intend on conducting a short scan of the altered memory addresses after all add/updates/deletes from the link tables and then subsequently storing the ALDB Delta.  Theoretically we should be able to banish scan all links and scan device links from nearly all use.  The only real need for them would be for installing new devices or to capture any manual changes.


On Tue, Jan 29, 2013 at 12:14 PM, Kevin Robert Keegan <kevin@krkeegan.com> wrote:
You are probably right, at least initially a separate voice command is probably best.  

I am not advocating that this would enable us to get rid of scans completely.  Any manual change would require a complete rescan of that device.  

However, any add/update/delete of the links on the device by MH would only require a scan of the specific memory location that was changed.  You could in theory assume that the add/update/delete commands were received properly, but as you said, that is probably a dangerous assumption to make.

Absent changes in the link table, I don't think MH needs to audit the records at all.

  


On Tue, Jan 29, 2013 at 11:52 AM, Michael Stovenour <michael@stovenour.net> wrote:

On Jan 28, 2013 7:28pm Kevin wrote:

 

I just stumbled across this.

Insteon Command 0x19 "Status Request"
Returned ACK message will contain the On-Level in Command 2.

Command 1 will contain an ALL-Link Database Delta number that increments every time there is a change in the addressee’s ALL-Link Database.

 

If command 1 is accurate, then as long as the increment number matches the last full scan conducted by MH, we know that the database on the device still matches what is in MH.  In that case, we would not need to scan the device.  MH just ignores this number right now.

 

"Scan all device links" could be changed to, "scan all device links that have changed."  This would be faster and would risk less possible errors.

 

I think that is fine if you are only interested in picking up links that were created by manually linking devices; however I think the link scan is also used to “clean up” the MH version of the device aldb.  Given how fragile the logic seems, I suspect that the MH version of the device aldb needs to be at least audited periodically.  I don’t think it is a good idea to do away with the current voice commands that do a full scan.  Some new commands might be a good idea.  You could use the same code subs by introducing a flag that would support both modes.