Skip to content

Add Matter HRAP Support #2283

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add Matter HRAP Support #2283

wants to merge 1 commit into from

Conversation

hcarter-775
Copy link
Contributor

@hcarter-775 hcarter-775 commented Jul 25, 2025

Description of Change

Implements handling for the TBR and NIM Device Types. Includes a basic thread operational dataset parser.

Summary of Completed Tests

Tested using CHIP Example App, VDA, and is verified with unit tests.

Copy link

Duplicate profile check: Passed - no duplicate profiles detected.

Copy link

Copy link

github-actions bot commented Jul 25, 2025

File Coverage
All files NaN%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 304cbf1

Copy link

github-actions bot commented Jul 25, 2025

Test Results

   69 files    448 suites   0s ⏱️
2 325 tests 2 325 ✅ 0 💤 0 ❌
3 924 runs  3 924 ✅ 0 💤 0 ❌

Results for commit 304cbf1.

♻️ This comment has been updated with latest results.

@nickolas-deboom
Copy link
Contributor

I looked over the cluster-capability mappings again and passed over the driver again and things look good from my perspective. One more question I had is have you tested using the embedded cluster definitions?

@hcarter-775
Copy link
Contributor Author

I looked over the cluster-capability mappings again and passed over the driver again and things look good from my perspective. One more question I had is have you tested using the embedded cluster definitions?

Good callout! Yes, this has been tested now. There actually was a small typo bug that got fixed in the latest commit

@HunsupJung
Copy link
Collaborator

@hcarter-775
I tested it with VDA (1.4.8) and there's no issue.

Copy link

@nand-nor nand-nor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work Harrison!

@hcarter-775 hcarter-775 force-pushed the add-matter-hrap branch 2 times, most recently from 75fe862 to 85bd6ca Compare August 18, 2025 18:15
Copy link
Contributor

@ctowns ctowns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work Harrison! I appreciate the helpful comments that are included throughout, and the organization of the handlers is very clean 💯

device:subscribe()
local tbrm_eps = embedded_cluster_utils.get_endpoints(device, clusters.ThreadBorderRouterManagement.ID)
if tbrm_eps and #tbrm_eps > 0 then
device:send(clusters.ThreadBorderRouterManagement.server.commands.GetActiveDatasetRequest(device, tbrm_eps[1]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming - is the active dataset expected to change at any point? Why is it read each driver startup, but not cached? And if it is expected to change, why not subscribe to this attribute?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this dataset can change, and we can't subscribe to it because this is a command, not an attribute. Perhaps we could add some better logic to not re-read the data on each and every restart? Can look into this a bit more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is strange that this could be expected to change, but the spec doesn't provide an event that we can subscribe to. I not super familiar with HRAP stuff, so sorry if this is a dumb question - what is a scenario in which this value would change?

Based on a cursory read of the spec, it seems like the ActiveDatasetTimestamp attribute contains the most recent timestamp for the active dataset, and shall be updated when a new active dataset is configured. I think then we are supposed to monitor this attribute and then send the command to get the latest dataset when that attribute changes, or when we notice that the timestamp does not match the last timestamp that we cached in the case of a driver restart.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to answer your first question, there are a few cases. One would be going from no thread network configured to one being configured, and to move between networks would occur in the case that a user wanted to merge their thread networks across multiples thread border routers, which is a major part of the thread unification initiative.

To the second point, I think that's a good idea and a cleaner solution than arbitrarily retrying on a restart.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added in latest commit

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @ctowns, we can subscribe to the active timestamp attribute, which is a reliable indicator of dataset change. This is also how we track changes within hub-core

if not ib.data.value then
device.log.info("No Thread operational dataset configured")
elseif ib.data.value ~= device:get_field(CURRENT_ACTIVE_DATASET_TIMESTAMP) then
local tbrm_ep = embedded_cluster_utils.get_endpoints(device, clusters.ThreadBorderRouterManagement.ID)[1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could use use the ib.endpoint_id instead of getting the endpoint that supports border router management, since that should be the same endpoint that provided this interacton block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for sure, moved it thoughtlessly out of device_init where this handling was required.

Copy link
Contributor

@ctowns ctowns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one more small comment, otherwise this looks good to me!

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.

5 participants