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

Fix for Issue #75 - Correct Handling of All_Link Commands #78

Merged
merged 9 commits into from
Feb 19, 2013

Conversation

krkeegan
Copy link
Collaborator

What this does:

  • Direct Cleanups from Devices to a PLM_Scene are essentially ignored, there really is nothing to process with them.
  • An All_Link_Failure report (which occurs when an individual device doesn't respond) now causes MH to push a direct message for that device to the front of the queue. MH will then retry as normal to appropriately set this device.
  • MH should wait until the All_Linking process is complete before trying to send another message. (If we try to send a message before the linking is done, we will cause the All_Link process to fail). The All_Link process can take a while (6 seconds for 20 devices in my case). So in order to prevent a lockup waiting for a confirmation that never arrives, MH initially sets the timeout at 3 seconds and then resets the timeout each time an All_Link Direct cleanup ACK is received or if an All_Link_Failure is received.
  • MH waits until the ALL_Link Status Report (success or failure) to clear the message.

Of Note:

  • All_Link_Failure is only 6 bytes, not 7 as defined in the documentation. I fixed the PLM parsing and Michael's message decoder.
  • All_Link_Status always reports success if it was allowed to run completely, even if individual devices fail to respond. Luckily those individual reports are caught by All_Link_Failure. The only way to get an All_Link_Status failure is to send a message from the computer (not a device) to the PLM before the process is complete. If that happens, and it really shouldn't unless the timeout is too short, MH will retry the PLM_Scene again.

I didn't touch Device based All_Link Commands:

  • The initial broadcast message is ignored.
  • The item is only updated when the direct message is received.
  • We could do something with the broadcast. (Is it possible that a broadcast would arrive but not the direct message?)

Fixes Issue #75

Don't clear active message on direct all link received messages. Likely need to push them to an array.

Clear active message when All-Link Status Report received.  If NACK received, need to check array for devices that have not responded.

Needed to grossly increase send_timeout to allow time for this to run, for one of my scenes this takes 6 seconds.
All Link Commands from the PLM can take a very long time to process.  The amount of time depends on the number of objects linked to this scene.  Plus if the PLM is forced to send any direct commands, this can take even longer.

For example, on my network, sending a command to 20 devices without any direct commands took 6 seconds.

We obviously can't set a send_timeout for this amount of time.  So instead, we set a normal initial timeout and then keep resetting the timeout when we receive a direct ACK or NACK because these are signs that the PLM is still working on the command.

Now, since the final message from the PLM should never fail to arrive, we never really need to worry about this.  But we need some timeout, otherwise we have the possibility of having MH lockup waiting for a message that never arrives.
Next add members to array for object
…Link Cleanup Failure Report

Misunderstood what would be warrant a NACK in the All Link Status Report.  A NACK is only issued if the PLM is interrupted in sending the direct commands. As such ACK HASH is not needed.

Instead an ALL-Link Cleanup Failure Report is issued if a device fails to respond.

However, the ALL-Link Cleanup Failure Report is incorrectly documented in the Modem guide.  The message is only 6 bytes long and byte 3 in the documentation doesn't exist.
Added ability to send all link direct cleanup messages to devices that failed to respond to PLM scene command.
Their commands are identical to on and off and adding the All_Link message type keys to the hash caused issues as an on command sent from a device now appeared to be an All_Link_Recall.
krkeegan added a commit that referenced this pull request Feb 19, 2013
Fix for Issue #75 - Correct Handling of All_Link Commands
@krkeegan krkeegan merged commit 3f55ca7 into hollie:master Feb 19, 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