8000 A sample Matter Controller Electron UI Application. by markus-becker-tridonic-com · Pull Request #2223 · project-chip/matter.js · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A sample Matter Controller Electron UI Application. #2223

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 2 commits into
base: main
Choose a base branch
from

Conversation

markus-becker-tridonic-com
Copy link
Contributor

Based on

  • Electron
  • Vite
  • React
  • Bootstrap CSS & Icons
  • Typescript

Currently, it is only able to commission a single device via BLE onto Thread and on a restart connect to it again. Even on Windows.

Missing features:

  • Dealing with multiple devices
  • Showing connectivity status
  • Interactions (Read, Write, Invoke, ...) with the device and displaying results
  • WiFi commissioning
  • Handling errors
  • ....

Some Mock UI is commented in app.tsx.

Based on
* Electron
* Vite
* React
* Bootstrap CSS & Icons
* Typescript

Currently, it is only able to commission a single device via BLE onto Thread and on a restart connect to it again. Even on Windows.

Missing features:
* Dealing with multiple devices
* Showing connectivity status
* Interactions (Read, Write, Invoke, ...) with the device and displaying results
* WiFi commissioning
* Handling errors
* ....

Some Mock UI is commented in app.tsx.
Copy link
Contributor
@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new sample Matter Controller Electron UI application. Review focuses on improving correctness and maintainability, addressing potential critical issues such as the application exiting automatically and high severity issues such as runtime errors due to lack of input validation.

Comment on lines +39 to +40
parseInt(matterLongDiscriminatorText),
parseInt(matterPasscodeText)
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Using parseInt directly on user input without validation is risky. If the input is not a valid number, parseInt will return NaN, potentially causing issues in the native Matter.js code. Add validation to ensure the parsed values are numbers before calling the API.

threadOperationalDatasetText,
matterLongDiscriminatorNumber,
matterPasscodeNumber
).catch(error => console.log(error));
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This .catch block swallows any errors from the ControllerNode. The renderer process will not be notified of the failure, making it difficult to provide feedback to the user. It's better to let the promise reject so the error can be caught in the renderer process.

// console.log("Found commissioned nodes:", Diagnostic.json(nodes));
console.log("Found commissioned nodes:", nodes);

const nodeId = NodeId(environment.vars.number("nodeid") ?? nodes[0]);
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Accessing nodes[0] without checking if the nodes array is empty can cause a crash if getCommissionedNodes() returns no nodes. Add a check for nodes.length > 0 before attempting to access an element.

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.

1 participant
0