@homebridge-plugins/homebridge-matter 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,7 +16,11 @@
16
16
  "Bash(find:*)",
17
17
  "Bash(cat:*)",
18
18
  "Read(//Users/benpotter/.homebridge/matter/**)",
19
- "Read(//Users/benpotter/.homebridge/**)"
19
+ "Read(//Users/benpotter/.homebridge/**)",
20
+ "Read(//Users/benpotter/Documents/GitHub/**)",
21
+ "Bash(npm run watch)",
22
+ "Bash(pkill -f homebridge)",
23
+ "Bash(pkill -9 -f \"npm run watch\")"
20
24
  ],
21
25
  "deny": [],
22
26
  "ask": []
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to `@homebridge-plugins/homebridge-matter` will be documented in this file.
4
4
 
5
+ ## v0.0.5 (2025-10-18)
6
+
7
+ ### Changes
8
+
9
+ - testing more device types as examples
10
+
11
+ ## v0.0.4 (2025-10-18)
12
+
13
+ ### Changes
14
+
15
+ - follow homebridge api updates, examples for switches/sensors
16
+ - general repo updates, license, package updates, etc
17
+
5
18
  ## v0.0.3 (2025-10-17)
6
19
 
7
20
  ### Changes
package/LICENSE CHANGED
@@ -1,176 +1,21 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
1
+ MIT License
2
+
3
+ Copyright (c) Ben Potter
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -6,127 +6,10 @@
6
6
 
7
7
  <span align="center">
8
8
 
9
- # Homebridge Platform Plugin Template
9
+ # Homebridge Matter
10
10
 
11
11
  </span>
12
12
 
13
- > [!IMPORTANT]
14
- > **Homebridge v2.0 Information**
15
- >
16
- > This template currently has a
17
- > - `package.json -> engines.homebridge` value of `"^1.8.0 || ^2.0.0-beta.0"`
18
- > - `package.json -> devDependencies.homebridge` value of `"^2.0.0-beta.0"`
19
- >
20
- > This is to ensure that your plugin will build and run on both Homebridge v1 and v2.
21
- >
22
- > Once Homebridge v2.0 has been released, you can remove the `-beta.0` in both places.
23
-
24
- ---
25
-
26
- This is a template Homebridge dynamic platform plugin and can be used as a base to help you get started developing your own plugin.
27
-
28
- This template should be used in conjunction with the [developer documentation](https://developers.homebridge.io/). A full list of all supported service types, and their characteristics is available on this site.
29
-
30
- ### Clone As Template
31
-
32
- Click the link below to create a new GitHub Repository using this template, or click the *Use This Template* button above.
33
-
34
- <span align="center">
35
-
36
- ### [Create New Repository From Template](https://github.com/homebridge/homebridge-plugin-template/generate)
37
-
38
- </span>
39
-
40
- ### Setup Development Environment
41
-
42
- To develop Homebridge plugins you must have Node.js 18 or later installed, and a modern code editor such as [VS Code](https://code.visualstudio.com/). This plugin template uses [TypeScript](https://www.typescriptlang.org/) to make development easier and comes with pre-configured settings for [VS Code](https://code.visualstudio.com/) and ESLint. If you are using VS Code install these extensions:
43
-
44
- - [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
45
-
46
- ### Install Development Dependencies
47
-
48
- Using a terminal, navigate to the project folder and run this command to install the development dependencies:
49
-
50
- ```shell
51
- npm install
52
- ```
53
-
54
- ### Update package.json
55
-
56
- Open the [`package.json`](./package.json) and change the following attributes:
57
-
58
- - `name` - this should be prefixed with `homebridge-` or `@username/homebridge-`, is case-sensitive, and contains no spaces nor special characters apart from a dash `-`
59
- - `displayName` - this is the "nice" name displayed in the Homebridge UI
60
- - `homepage` - link to your GitHub repo's `README.md`
61
- - `repository.url` - link to your GitHub repo
62
- - `bugs.url` - link to your GitHub repo issues page
63
-
64
- When you are ready to publish the plugin you should set `private` to false, or remove the attribute entirely.
65
-
66
- ### Update Plugin Defaults
67
-
68
- Open the [`src/settings.ts`](./src/settings.ts) file and change the default values:
69
-
70
- - `PLATFORM_NAME` - Set this to be the name of your platform. This is the name of the platform that users will use to register the plugin in the Homebridge `config.json`.
71
- - `PLUGIN_NAME` - Set this to be the same name you set in the [`package.json`](./package.json) file.
72
-
73
- Open the [`config.schema.json`](./config.schema.json) file and change the following attribute:
74
-
75
- - `pluginAlias` - set this to match the `PLATFORM_NAME` you defined in the previous step.
76
-
77
- See the [Homebridge API docs](https://developers.homebridge.io/#/config-schema#default-values) for more details on the other attributes you can set in the `config.schema.json` file.
78
-
79
- ### Build Plugin
80
-
81
- TypeScript needs to be compiled into JavaScript before it can run. The following command will compile the contents of your [`src`](./src) directory and put the resulting code into the `dist` folder.
82
-
83
- ```shell
84
- npm run build
85
- ```
86
-
87
- ### Link To Homebridge
88
-
89
- Run this command so your global installation of Homebridge can discover the plugin in your development environment:
90
-
91
- ```shell
92
- npm link
93
- ```
94
-
95
- You can now start Homebridge, use the `-D` flag, so you can see debug log messages in your plugin:
96
-
97
- ```shell
98
- homebridge -D
99
- ```
100
-
101
- ### Watch For Changes and Build Automatically
102
-
103
- If you want to have your code compile automatically as you make changes, and restart Homebridge automatically between changes, you first need to add your plugin as a platform in `./test/hbConfig/config.json`:
104
- ```
105
- {
106
- ...
107
- "platforms": [
108
- {
109
- "name": "Config",
110
- "port": 8581,
111
- "platform": "config"
112
- },
113
- {
114
- "name": "<PLUGIN_NAME>",
115
- //... any other options, as listed in config.schema.json ...
116
- "platform": "<PLATFORM_NAME>"
117
- }
118
- ]
119
- }
120
- ```
121
-
122
- and then you can run:
123
-
124
- ```shell
125
- npm run watch
126
- ```
127
-
128
- This will launch an instance of Homebridge in debug mode which will restart every time you make a change to the source code. It will load the config stored in the default location under `~/.homebridge`. You may need to stop other running instances of Homebridge while using this command to prevent conflicts. You can adjust the Homebridge startup command in the [`nodemon.json`](./nodemon.json) file.
129
-
130
13
  ### Customise Plugin
131
14
 
132
15
  You can now start customising the plugin template to suit your requirements.
@@ -167,81 +50,3 @@ function handleExternalChange(newState: boolean) {
167
50
 
168
51
  See [`STATE_MANAGEMENT.md`](./STATE_MANAGEMENT.md) for complete details and examples.
169
52
 
170
- ### Versioning Your Plugin
171
-
172
- Given a version number `MAJOR`.`MINOR`.`PATCH`, such as `1.4.3`, increment the:
173
-
174
- 1. **MAJOR** version when you make breaking changes to your plugin,
175
- 2. **MINOR** version when you add functionality in a backwards compatible manner, and
176
- 3. **PATCH** version when you make backwards compatible bug fixes.
177
-
178
- You can use the `npm version` command to help you with this:
179
-
180
- ```shell
181
- # major update / breaking changes
182
- npm version major
183
-
184
- # minor update / new features
185
- npm version update
186
-
187
- # patch / bugfixes
188
- npm version patch
189
- ```
190
-
191
- ### Publish Package
192
-
193
- When you are ready to publish your plugin to [npm](https://www.npmjs.com/), make sure you have removed the `private` attribute from the [`package.json`](./package.json) file then run:
194
-
195
- ```shell
196
- npm publish
197
- ```
198
-
199
- If you are publishing a scoped plugin, i.e. `@username/homebridge-xxx` you will need to add `--access=public` to command the first time you publish.
200
-
201
- #### Publishing Beta Versions
202
-
203
- You can publish *beta* versions of your plugin for other users to test before you release it to everyone.
204
-
205
- ```shell
206
- # create a new pre-release version (eg. 2.1.0-beta.1)
207
- npm version prepatch --preid beta
208
-
209
- # publish to @beta
210
- npm publish --tag beta
211
- ```
212
-
213
- Users can then install the *beta* version by appending `@beta` to the install command, for example:
214
-
215
- ```shell
216
- sudo npm install -g homebridge-example-plugin@beta
217
- ```
218
-
219
- ### Best Practices
220
-
221
- Consider creating your plugin with the [Homebridge Verified](https://github.com/homebridge/verified) criteria in mind. This will help you to create a plugin that is easy to use and works well with Homebridge.
222
- You can then submit your plugin to the Homebridge Verified list for review.
223
- The most up-to-date criteria can be found [here](https://github.com/homebridge/verified#requirements).
224
- For reference, the current criteria are:
225
-
226
- - **General**
227
- - The plugin must be of type [dynamic platform](https://developers.homebridge.io/#/#dynamic-platform-template).
228
- - The plugin must not offer the same nor less functionality than that of any existing **verified** plugin.
229
- - **Repo**
230
- - The plugin must be published to NPM and the source code available on a GitHub repository, with issues enabled.
231
- - A GitHub release should be created for every new version of your plugin, with release notes.
232
- - **Environment**
233
- - The plugin must run on all [supported LTS versions of Node.js](https://github.com/homebridge/homebridge/wiki/How-To-Update-Node.js), at the time of writing this is Node v18, v20 and v22.
234
- - The plugin must successfully install and not start unless it is configured.
235
- - The plugin must not execute post-install scripts that modify the users' system in any way.
236
- - The plugin must not require the user to run Homebridge in a TTY or with non-standard startup parameters, even for initial configuration.
237
- - **Codebase**
238
- - The plugin must implement the [Homebridge Plugin Settings GUI](https://developers.homebridge.io/#/config-schema).
239
- - The plugin must not contain any analytics or calls that enable you to track the user.
240
- - If the plugin needs to write files to disk (cache, keys, etc.), it must store them inside the Homebridge storage directory.
241
- - The plugin must not throw unhandled exceptions, the plugin must catch and log its own errors.
242
-
243
- ### Useful Links
244
-
245
- Note these links are here for help but are not supported/verified by the Homebridge team
246
-
247
- - [Custom Characteristics](https://github.com/homebridge/homebridge-plugin-template/issues/20)
@@ -11,7 +11,7 @@
11
11
  "name": {
12
12
  "title": "Name",
13
13
  "type": "string",
14
- "default": "Example Dynamic Platform"
14
+ "default": "Homebridge Matter"
15
15
  }
16
16
  }
17
17
  }
@@ -8,12 +8,18 @@ export declare class ExampleHomebridgePlatform implements DynamicPlatformPlugin
8
8
  readonly config: PlatformConfig;
9
9
  readonly api: API;
10
10
  readonly accessories: Map<string, PlatformAccessory>;
11
+ readonly matterAccessories: Map<string, any>;
11
12
  constructor(log: Logging, config: PlatformConfig, api: API);
12
13
  /**
13
14
  * Required for DynamicPlatformPlugin
14
15
  * Called when homebridge restores cached accessories from disk at startup
15
16
  */
16
- configureAccessory(): void;
17
+ configureAccessory(accessory: PlatformAccessory): void;
18
+ /**
19
+ * Called for each cached Matter accessory restored from disk
20
+ * Track these so we can determine which accessories to remove in didFinishLaunching
21
+ */
22
+ configureMatterAccessory(accessory: any): void;
17
23
  /**
18
24
  * Register all Matter accessory examples
19
25
  */
@@ -22,4 +28,28 @@ export declare class ExampleHomebridgePlatform implements DynamicPlatformPlugin
22
28
  * Lighting Devices
23
29
  */
24
30
  private registerLightingDevices;
31
+ /**
32
+ * Switches and Outlets
33
+ */
34
+ private registerSwitchesAndOutlets;
35
+ /**
36
+ * Register Matter sensor accessories
37
+ */
38
+ private registerSensors;
39
+ /**
40
+ * Register Matter HVAC accessories (Thermostats, Fans)
41
+ */
42
+ private registerHVAC;
43
+ /**
44
+ * Register Matter Security & Access accessories (Door Locks, Garage Doors)
45
+ */
46
+ private registerSecurity;
47
+ /**
48
+ * Register Matter Window Covering accessories (Blinds, Shades)
49
+ */
50
+ private registerWindowCoverings;
51
+ /**
52
+ * Register Matter Appliance accessories (Robotic Vacuum Cleaners, etc.)
53
+ */
54
+ private registerAppliances;
25
55
  }