-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[matter] Initial contribution #18486
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
Conversation
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
I can look at the readme, thing structure and java code etc. But i'm no good at the typescript / nodejs / json stuff. Hope others are available to jointly review this. |
Same thing for me. |
I can jump in to take a look at the TypeScript/JavaScript code 👍 |
Thanks everyone ! Couple things: @florian-h05 , I kept the Typescript code at a minimum, as my goal was to keep as much logic as possible in Java land. The matter websocket server is basically a glorified RPC service for the controller side, using the JS equivalent of reflection to execute cluster commands dynamically. The bridge side of the websocket server is a little more complicated, but again i kept the logic there at a minimum, just thin wrappers around device types. Would appreciate your review of all of this. I know there's some cleanup i should probably be doing. I would not spend to much time (or any) in the code-gen part, fortunately it only needs to be run if there are matter specification changes to generate new Java cluster classes. As you can imagine, creating Java classes from handlebar templates was difficult (but works shockingly well). One thing might be tweaking the templates to produce better formatted code, but the maven build runs spotless against the generated classes as part of the code-gen build task, so maybe not so important. So the bulk of the logic is in the Java code, hopefully that makes it a bit easier. The DEVELOPMENT.md readme has some info on the structure (client, controller, bridge) , hopefully that helps too. |
Maybe it has been asked before. Is there a specific reason that the client and bridge part are combined into one binding? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @digitaldan for this amazing binding! I will try to help out with the review as well, although with limited capacity and sadly currently no ability to try it out.
I had a very quick look at some of the code, and it already looks quite solid.
I have added a few very minor comments from first iteration through the README.
...ter/src/main/java/org/openhab/binding/matter/internal/controller/MatterControllerClient.java
Outdated
Show resolved
Hide resolved
...matter/src/main/java/org/openhab/binding/matter/internal/handler/MatterBaseThingHandler.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.matter/src/main/resources/OH-INF/addon/addon.xml
Show resolved
Hide resolved
I was thinking about this quite a bit actually. And the code is partitioned that way actually. But ultimately my reasoning was this.
Obviously i was on the fence on this one, but ultimately decided on wanting this easy for users. If there are strong feelings about this, i'm open for further discussion. |
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
… upgrades matter sdk Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
FYI, i forgot that the ConsoleCommandExtension.java file is not complete, i'm hoping to work on it a bit this weekend, but if i don't find time, i just may remove it for now. |
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm flushing a few fragmented comments, sorry for that. As I'm trying to acquiant myself with the binding I'm going back and forth through different bits and adding comments along the way. I could hold them back and publish all at once, but the PR would probably be merged by then. 😄
bundles/org.openhab.binding.matter/src/main/resources/OH-INF/thing/channels.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.matter/src/main/resources/OH-INF/thing/channels.xml
Outdated
Show resolved
Hide resolved
.../openhab/binding/matter/internal/controller/devices/converter/ColorControlConverterTest.java
Outdated
Show resolved
Hide resolved
...ing.matter/src/main/java/org/openhab/binding/matter/internal/bridge/devices/ColorDevice.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.matter/src/main/resources/OH-INF/thing/channels.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.matter/src/main/resources/OH-INF/thing/channels.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.matter/src/main/resources/OH-INF/thing/channels.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.matter/src/main/resources/OH-INF/thing/channels.xml
Outdated
Show resolved
Hide resolved
Refs openhab/openhab-addons#18486 --------- Also-by: Florian Hotze <dev@florianhotze.com> Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Thanks everyone, i think i have addressed all outstanding comments with my last PR. I would be good merging as is right now, i think its in good shape thanks to the thoughtful reviews. I will follow up this weekend with a few more PRs around TS formatting, more docs, as well as some new devices i have been holding off on adding until this is merged. |
Let me check the changes this evening 👍 |
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typescript code LGTM now, apart from the license header in the utils, I don’t know if it should be there.
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Just pushed an update to address the last comment, thanks! |
In case an urgent merge is required, I can already confirm that all my existing comments were properly handled, thank you Dan. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few questions mainly about ColorControlConverter
...va/org/openhab/binding/matter/internal/controller/devices/converter/ThermostatConverter.java
Outdated
Show resolved
Hide resolved
.../org/openhab/binding/matter/internal/controller/devices/converter/ColorControlConverter.java
Outdated
Show resolved
Hide resolved
.../org/openhab/binding/matter/internal/controller/devices/converter/ColorControlConverter.java
Outdated
Show resolved
Hide resolved
.../org/openhab/binding/matter/internal/controller/devices/converter/ColorControlConverter.java
Outdated
Show resolved
Hide resolved
.../org/openhab/binding/matter/internal/controller/devices/converter/ColorControlConverter.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review of class MatterControllerClient
...ter/src/main/java/org/openhab/binding/matter/internal/controller/MatterControllerClient.java
Outdated
Show resolved
Hide resolved
...ter/src/main/java/org/openhab/binding/matter/internal/controller/MatterControllerClient.java
Outdated
Show resolved
Hide resolved
...ter/src/main/java/org/openhab/binding/matter/internal/controller/MatterControllerClient.java
Outdated
Show resolved
Hide resolved
* @param nodeId the node ID to get the pairing codes for | ||
* @return a future that completes when the pairing codes are retrieved | ||
*/ | ||
public CompletableFuture<PairingCodes> enhancedCommissioningWindow(BigInteger nodeId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you add JsonParseException
as possible thrown exception ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea was to add it not only in javadoc but also in method declaration.
...ter/src/main/java/org/openhab/binding/matter/internal/controller/MatterControllerClient.java
Outdated
Show resolved
Hide resolved
...ter/src/main/java/org/openhab/binding/matter/internal/controller/MatterControllerClient.java
Show resolved
Hide resolved
...ter/src/main/java/org/openhab/binding/matter/internal/controller/MatterControllerClient.java
Show resolved
Hide resolved
...ter/src/main/java/org/openhab/binding/matter/internal/controller/MatterControllerClient.java
Outdated
Show resolved
Hide resolved
...ter/src/main/java/org/openhab/binding/matter/internal/controller/MatterControllerClient.java
Show resolved
Hide resolved
Thanks @lolodomo , i'll have time tomorrow afternoon PDT to address and get a commit posted asap. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few minor remarks when reviewing partially the handler package
...ab.binding.matter/src/main/java/org/openhab/binding/matter/internal/handler/NodeHandler.java
Outdated
Show resolved
Hide resolved
...ab.binding.matter/src/main/java/org/openhab/binding/matter/internal/handler/NodeHandler.java
Outdated
Show resolved
Hide resolved
...matter/src/main/java/org/openhab/binding/matter/internal/handler/MatterBaseThingHandler.java
Outdated
Show resolved
Hide resolved
...matter/src/main/java/org/openhab/binding/matter/internal/handler/MatterBaseThingHandler.java
Outdated
Show resolved
Hide resolved
...ab.binding.matter/src/main/java/org/openhab/binding/matter/internal/handler/NodeHandler.java
Show resolved
Hide resolved
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Latest commit should address the latest comments, thanks! |
if (lastOnOff) | ||
updateState(CHANNEL_ID_COLOR_TEMPERATURE, miredsToPercentType(lastColorTemperatureMireds)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add {} in a next change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for sure.
@jlaur : I let you the privilege to push the merge button as you are the only one to have done a full review ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this important binding and all the effort invested in this, @digitaldan. Awesome work! 👍 Let's get this merged for the next milestone, and also so the related work in other repos can progress.
I plan to run new tests with the official version in the coming days. |
Dan, I was asking myself if you could list what is not yet supported by the binding? Type of devices, certain features, ... |
Yeah, i think putting together a supported matter Device Type list would be good, i'll look into it. |
Dan, I just checked the JSON I sent to you in the past for my Matter lightbulb and colorTempPhysicalMinMireds is 153.
As we have difficulties to build a new snapshot, I compiled the binding form code and installed it in a previous snapshot. |
Sorry, that was my mistake, i meant to test if its == "0" not less then the default min, i'll post a fix right now for that. |
No, your right, i'm doing an unnecessary Math.max on that, i'll fix that and put a test in for it |
Dan, now, you could add the binding's logo to the openHAB website. See https://www.openhab.org/docs/developer/addons/#add-your-add-on-s-logo-to-the-openhab-website |
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
The Matter Binding for openHAB allows seamless integration with Matter-compatible devices.
This binding supports 2 different types of matter functionality which operate independently of each other.
This has been published on the market place as a 4.x binding for almost 6 months and has seen quite a bit of usage on a variety of networks, platforms and matter devices. So its relatively tested and performing well. I am personally running my home system with 20+ real matter devices (and growing), and using the matter bridge to expose around 100 devices/items to Alexa, Google and Apple for local voice control.
Other openHAB projects that will need enhancements (volunteers wanted !)
matter
tags along with existing Alexa, GA and Homekit tags for items for voice controlThere are a lot of moving pieces in this binding, i have started some documentation to help explain this, as well as quite a bit of docs in the README.
A Big thank you to the matter.js team, especially Apollon77 for both developing the matter.js SDK and helping troubleshoot many, many early issues with the binding.
I realize this is going to be a pain to review, so i apologize in advance to our maintainers ;-) The goal is to have this in for the 5.0 release! So hopefully we have enough time.