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

Matter 1.4 Driver Release #1870

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Matter 1.4 Driver Release #1870

wants to merge 12 commits into from

Conversation

nickolas-deboom
Copy link
Contributor

@nickolas-deboom nickolas-deboom commented Jan 13, 2025

Type of Change

  • WWST Certification Request
    • If this is your first time contributing code:
      • I have reviewed the README.md file
      • I have reviewed the CODE_OF_CONDUCT.md file
      • I have signed the CLA
    • I plan on entering a WWST Certification Request or have entered a request through the WWST Certification console at developer.smartthings.com
  • Bug fix
  • New feature
  • Refactor

Checklist

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have verified my changes by testing with a device or have communicated a plan for testing
  • I am adding new behavior, such as adding a sub-driver, and have added and run new unit tests to cover the new behavior

Description of Change

This PR contains changes to support new device types introduced by the Matter 1.4 specification. These device types include the following:

  • Network Infrastructure Management
  • Thread Border Router
  • Mounted On/Off Control (CHAD-14600)
  • Mounted Dimmable Load Control (CHAD-14601)
  • Water Heater
  • Solar Power
  • Battery Storage
  • Heat Pump

Summary of Completed Tests

Copy link

Copy link

github-actions bot commented Jan 13, 2025

Test Results

   65 files  + 1    412 suites  +6   0s ⏱️ ±0s
2 037 tests +24  2 037 ✅ +24  0 💤 ±0  0 ❌ ±0 
3 529 runs  +40  3 529 ✅ +40  0 💤 ±0  0 ❌ ±0 

Results for commit 6f0a524. ± Comparison against base commit 7171fd3.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jan 13, 2025

matter-evse_coverage.xml

File Coverage
All files 83%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-evse/src/init.lua 83%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-evse/src/embedded_cluster_utils.lua 82%

matter-hrap_coverage.xml

File Coverage
All files 100%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-evse/src/init.lua 83%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-evse/src/embedded_cluster_utils.lua 82%

matter-switch_coverage.xml

File Coverage
All files 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-evse/src/init.lua 83%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-evse/src/embedded_cluster_utils.lua 82%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/embedded-cluster-utils.lua 38%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/aqara-cube/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/eve-energy/init.lua 91%

matter-thermostat_coverage.xml

File Coverage
All files 82%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-evse/src/init.lua 83%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-evse/src/embedded_cluster_utils.lua 82%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/embedded-cluster-utils.lua 38%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/aqara-cube/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/eve-energy/init.lua 91%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-thermostat/src/init.lua 83%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-thermostat/src/embedded-cluster-utils.lua 46%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 6f0a524

This initial commit adds support for the mounted on/off control and mounted
dimmable load control device types introduced by the matter 1.4 spec.
Copy link

Duplicate profile check: Passed - no duplicate profiles detected.

end

local function border_router_name_attribute_handler(driver, device, ib)
local router_name = ib.data.value
Copy link
Contributor

Choose a reason for hiding this comment

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

For my own understanding - why doesn't there need to be as much string verification for the border router name vs. the SSID name above?

Copy link
Contributor

@hcarter-775 hcarter-775 Jan 27, 2025

Choose a reason for hiding this comment

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

All of this is per the spec:
The border router name attribute is of type string, while the ssid is a type octsr. Therefore, border router name can be taken as is, while we have to ensure the Ssid can be displayed in a printable way (per wifi spec, ssid does not have to be written in UTF8). Further, SSID can be TLV-encoded null if a wifi network hasn't been set up yet on the TBR/NIM. So there's just some extra stuff with Ssid to watch out for per the spec.

However, I did add some extra logic for the border router name after a quick review of the spec- I had missed this on the first pass, but the spec specifies that the name is written <VendorName> <ProductName>._meshcop._udp. the new logic should remove ._meshcop._udp if present for a better user-facing display.

@nickolas-deboom
Copy link
Contributor Author

I left a few comments but everything else in the HRAP driver looks good to me! I can't remember but was there a file we've updated in the past to prevent github from checking test coverage of the embedded lua libs files? We could update that as part of this PR as well (I just can't remember where it is)

@nickolas-deboom
Copy link
Contributor Author

nickolas-deboom commented Jan 23, 2025

I get an error when trying to package the hrap driver locally:

» smartthings edge:drivers:package                                                                                                                                nickloasdeboom@MN-NDEBOOM-L
    AxiosError: Request failed with status code 422: {"requestId":"1610617032588185407","error":{"code":"ConstraintViolationError","message":"Invalid device profile specification for 
    eb1b3ce7-a434-4cd9-8fab-e5289b628b35","details":[{"code":"NotValidValue","target":"main.capabilities.routerName","message":"Capability does not exist: routerName version 
    1","details":[]},{"code":"NotValidValue","target":"main.capabilities.threadVersion","message":"Capability does not exist: threadVersion version 
    1","details":[]},{"code":"NotValidValue","target":"main.capabilities.routerState","message":"Capability does not exist: routerState version 1","details":[]}]}}
    Code: ERR_BAD_REQUEST

Is this happening due to the embedded capability definitions?

nickolas-deboom and others added 2 commits January 23, 2025 15:39
The mounted device types will already join to the correct fingerprint
and so do not require the logic added for them in initialize_switch to
select the correct profile.
@ctowns
Copy link
Contributor

ctowns commented Jan 27, 2025

Just a heads up, the current unit test results posted on the PR include coverage results for the embedded cluster definitions as well, so you'll want to add each of the new embedded cluster names to the config.luacov so that these cluster definitions are ignored in the code coverage calculations since they can add a lot of bloat to the coverage results and we don't necessarily use all the code in the embedded clusters.

@hcarter-775
Copy link
Contributor

hcarter-775 commented Jan 27, 2025

I get an error when trying to package the hrap driver locally:

» smartthings edge:drivers:package                                                                                                                                nickloasdeboom@MN-NDEBOOM-L
    AxiosError: Request failed with status code 422: {"requestId":"1610617032588185407","error":{"code":"ConstraintViolationError","message":"Invalid device profile specification for 
    eb1b3ce7-a434-4cd9-8fab-e5289b628b35","details":[{"code":"NotValidValue","target":"main.capabilities.routerName","message":"Capability does not exist: routerName version 
    1","details":[]},{"code":"NotValidValue","target":"main.capabilities.threadVersion","message":"Capability does not exist: threadVersion version 
    1","details":[]},{"code":"NotValidValue","target":"main.capabilities.routerState","message":"Capability does not exist: routerState version 1","details":[]}]}}
    Code: ERR_BAD_REQUEST

Is this happening due to the embedded capability definitions?

No, this is because the capabilities don't exist yet, though the embedded definitions work fine (as can be seen by the unit tests). I am currently in the process of getting these defined under a good namespace

@nickolas-deboom
Copy link
Contributor Author

Just a heads up, the current unit test results posted on the PR include coverage results for the embedded cluster definitions as well, so you'll want to add each of the new embedded cluster names to the config.luacov so that these cluster definitions are ignored in the code coverage calculations since they can add a lot of bloat to the coverage results and we don't necessarily use all the code in the embedded clusters.

I updated config.luacov in the latest commit: ae7066b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants