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

Rewrite/Rework of Sync_Links and Delete_Orphan_Links #293

Merged
merged 60 commits into from
Nov 15, 2013

Conversation

krkeegan
Copy link
Collaborator

This fixes issues #262, #272, #176, #82, and #73.

  • This is a complete rewrite of the Sync_Links and Delete_Orphan_links routines. In theory they are both easier to read and understand (at least they are for me). About 400 lines of extraneous code was removed. The separate Delete Orphans routine for the PLM has been condensed into a single codebase. Same with sync_links.
  • The Data3 value on control links is now properly set to the same value as the group value. (This will cause all old control links for buttons 2 and higher on devices to be deleted and resynced. Links on the PLM will not be touched as Data3 doesn't appear to have any ill effects if it is improperly set. All new controller links on the PLM will have the correct data3 value.)
  • The default Data3 value for responder links is set to 01 for i2cs devices, but remains 00 for non i2cs devices for the root device.
  • Sync links will now add the appropriate links to devices linked to deaf devices. Linked cannot be added to the deaf devices themselves, but at least half of the problem is handled.
  • A routine get_linkkey was also added, the routine is relatively simple and only returns the linkkey, but it cuts down on having to update this routine in multiple places if a change ever needs to be made.
  • Catch, recover and report errors in sync_all_links and delete_orphans links. This enables the same feature that has been available in the scan_all_links function. If an error occurs while attempting to either of these functions, MH now recovers from the error, and continues to process the remaining objects in the queue. At the conclusion of the routine a message is displayed identifying the failed objects.

The current code is completely stable. In my initial testing the links added and deleted by the respective routines appears to be accurate. But more elaborate testing will be needed to confirm.

One caveat, many of the links involving non_root devices will be recreated by running sync_links and delete_orphans (this is kind of the goal of the whole thing). But as a result, you probably don't want to switch back and forth between master and this.

krkeegan added 30 commits July 31, 2013 16:48
Fix bad typos in coding.  Not sure why I was attempting to dereferrence an object.
Don't call engine_version on PLM object
Add subaddress to linkkey in low level PLM aldb functions, has_, add_ and delete_link
…utton/Group

Should not be the data3 value from the PLM since data3 on PLM is now the PLM scene number
Conflicts:
	lib/Insteon/AllLinkDatabase.pm
Backwards compatability is just for testing purposes, will be removed eventually.
Plus set data3 to the proper value

And clean up perl warnings
It is a simple function, but this calculation is repeated all over the place.  Unifying the calculation ensures that it is always consistent.  Plus, if changes need to be made in the future, they can be more easily implemented.
…oller

This way we don't need to treat BaseObjects and InterfaceControlle objects differently.
…te_link

The distinction in the data3 value between i2CS and everything else only applies to repsonder links.

Remove any processing from the low level _write_link routine.  All processing of the data should occur higher up than this.
Ready to start testing the outputted results.
Data3 on controller links on the PLM should be set to the group.  The old code set this to 0 or the responding device's button.  It doesn't appear that this error had any major effect.  So rather than replace all of these links, simply ignore the data3 value in the linkkey so that old links will be accepted by sync and delete links.

The Data3 value of the responder links on the PLM should always be 00.

Therefore no concern that a different data3 value makes a link on the PLM unique.
Control Codes for Manage All Link Database entries do not appear to match reality.

Did not alter the code to address this, as it doesn't appear that d1-3 matter on the PLM and thus there is no reason to update a link.
Will add the responder/controller link to the other device even if the other device is deaf or unhealthy.
@krkeegan
Copy link
Collaborator Author

I made a few more tweaks today.

This seems to be working well.

This enables the same feature that has been available in the scan_all_links function.  If an error occurs while attempting to sync_all_links, MH now recovers from the error, and continues to process the remainin objects in Sync_All.  At the conclusion of the Sync_All routine a message is displayed identifying the failed objects.

Partial Fix hollie#73
Adds a similar functionality to what has been in scan all links.  If a failure occurs on a device while running delte orphans, MH now recovers and continues to process the rest of the delete queue.  At the conclusion of the queue, the failed object is reported.

Fixes hollie#82 hollie#73
@krkeegan
Copy link
Collaborator Author

Two more issues closed with this request. This adds and solves a rather annoying problem:

  • Catch, recover and report errors in sync_all_links and delete_orphans links. This enables the same feature that has been available in the scan_all_links function. If an error occurs while attempting to either of these functions, MH now recovers from the error, and continues to process the remaining objects in the queue. At the conclusion of the routine a message is displayed identifying the failed objects.

Prior to this, any error in either of these routines would have resulted in a stalled queue requiring a restart.

Fixes #73 and #82.

Conflicts:
	lib/Insteon/AllLinkDatabase.pm
	lib/Insteon/BaseInsteon.pm
If active message is not cleared, subsequent messages which are cued by the Retry Failure Callback will continue to call the Callback over and over.
When syncing an object if a device is skipped because the device is out of sync, the object will be reported in the failed objects list at the end of the sync process to help identify potentially out-of-sync devices.
Previously, if a single failure occured in a sync_queue, the whole queue was abandoned.  This attempts to resume where the queue left off.
If a device is skipped because it was out of sync, it will now appear in the final summary listing the devices for which delete orphans failed.
Condense list of failed devices into a single line in the print log.
krkeegan added a commit that referenced this pull request Nov 15, 2013
Rewrite/Rework of Sync_Links and Delete_Orphan_Links
@krkeegan krkeegan merged commit 68cdc41 into hollie:master Nov 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant