matterbridge 1.4.3 → 1.5.0

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,39 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  If you like this project and find it useful, please consider giving it a star on GitHub at https://github.com/Luligu/matterbridge and sponsoring it.
6
6
 
7
+ ## [1.5.0] - 2024-08-27
8
+
9
+ ### Breaking Changes
10
+
11
+ - [-bridge -childbridge]: You don't need anymore to add the parmeter -bridge or -childbridge on the command line or systemctl configuration or docker command: the default is bridge mode and if no parameter is added, Matterbridge uses the settings from the frontend that are saved.
12
+ - [-logger]: You don't need anymore to add the parmeter -logger [level]: the default is info and if no parameter is added, Matterbridge uses the settings from the frontend that are saved.
13
+ - [-filelogger]: You don't need anymore to add the parmeter -filelogger: the default is false and if no parameter is added, Matterbridge uses the settings from the frontend that are saved.
14
+ - [-matterlogger]: You don't need anymore to add the parmeter -matterlogger [level]: the default is info and if no parameter is added, Matterbridge uses the settings from the frontend that are saved.
15
+ - [-matterfilelogger]: You don't need anymore to add the parmeter -matterfilelogger: the default is false and if no parameter is added, Matterbridge uses the settings from the frontend that are saved.
16
+
17
+ ### Breaking Changes for developers
18
+
19
+ - please read this [Development guide lines](https://github.com/Luligu/matterbridge/blob/main/README-DEV.md)
20
+
21
+ ### Added
22
+
23
+ - [frontend]: Added menu item "Update".
24
+ - [frontend]: Added menu item "Restart".
25
+ - [frontend]: Added menu item "Shutdown".
26
+ - [frontend]: Added menu item "Download".
27
+ - [frontend]: Added menu item "Backup".
28
+ - [frontend]: Added menu item "Unregister all devices" with a confirmation dialog.
29
+ - [frontend]: Added menu item "Reset commissioning" with a confirmation dialog.
30
+ - [frontend]: Added menu item "Factory reset" with a confirmation dialog.
31
+
32
+ ### Changed
33
+
34
+ - [package]: Update dependencies.
35
+
36
+ <a href="https://www.buymeacoffee.com/luligugithub">
37
+ <img src="./yellow-button.png" alt="Buy me a coffee" width="120">
38
+ </a>
39
+
7
40
  ## [1.4.3] - 2024-08-22
8
41
 
9
42
  ### Added
@@ -0,0 +1,197 @@
1
+ # <img src="https://github.com/Luligu/matterbridge/blob/main/frontend/public/matterbridge%2064x64.png" alt="Matterbridge Logo" width="64px" height="64px">&nbsp;&nbsp;&nbsp;Matterbridge
2
+
3
+ [![npm version](https://img.shields.io/npm/v/matterbridge.svg)](https://www.npmjs.com/package/matterbridge)
4
+ [![npm downloads](https://img.shields.io/npm/dt/matterbridge.svg)](https://www.npmjs.com/package/matterbridge)
5
+ [![Docker Version](https://img.shields.io/docker/v/luligu/matterbridge?label=docker%20version&sort=semver)](https://hub.docker.com/r/luligu/matterbridge)
6
+ [![Docker Pulls](https://img.shields.io/docker/pulls/luligu/matterbridge.svg)](https://hub.docker.com/r/luligu/matterbridge)
7
+ ![Node.js CI](https://github.com/Luligu/matterbridge/actions/workflows/build.yml/badge.svg)
8
+
9
+ [![power by](https://img.shields.io/badge/powered%20by-matter--history-blue)](https://www.npmjs.com/package/matter-history)
10
+ [![power by](https://img.shields.io/badge/powered%20by-node--ansi--logger-blue)](https://www.npmjs.com/package/node-ansi-logger)
11
+ [![power by](https://img.shields.io/badge/powered%20by-node--persist--manager-blue)](https://www.npmjs.com/package/node-persist-manager)
12
+
13
+ ---
14
+
15
+ # Advanced configuration
16
+
17
+ ## Run matterbridge as a daemon with systemctl (Linux only)
18
+
19
+ Create a systemctl configuration file for Matterbridge
20
+
21
+ ```
22
+ sudo nano /etc/systemd/system/matterbridge.service
23
+ ```
24
+
25
+ Add the following to this file, replacing twice (!) USER with your user name (e.g. WorkingDirectory=/home/pi/Matterbridge and User=pi):
26
+
27
+ You may need to adapt the configuration to your setup:
28
+ - execStart on some linux distribution can also be ExecStart==/usr/bin/matterbridge -service
29
+
30
+ ```
31
+ [Unit]
32
+ Description=matterbridge
33
+ After=network-online.target
34
+
35
+ [Service]
36
+ Type=simple
37
+ ExecStart=matterbridge -service
38
+ WorkingDirectory=/home/<USER>/Matterbridge
39
+ StandardOutput=inherit
40
+ StandardError=inherit
41
+ Restart=always
42
+ RestartSec=10s
43
+ TimeoutStopSec=30s
44
+ User=<USER>
45
+
46
+ [Install]
47
+ WantedBy=multi-user.target
48
+ ```
49
+
50
+ If you modify it after, then run:
51
+
52
+ ```
53
+ sudo systemctl daemon-reload
54
+ ```
55
+
56
+ ### Start Matterbridge
57
+
58
+ ```
59
+ sudo systemctl start matterbridge
60
+ ```
61
+
62
+ ### Stop Matterbridge
63
+
64
+ ```
65
+ sudo systemctl stop matterbridge
66
+ ```
67
+
68
+ ### Show Matterbridge status
69
+
70
+ ```
71
+ sudo systemctl status matterbridge.service
72
+ ```
73
+
74
+ ### View the log of Matterbridge in real time (this will show the log with colors)
75
+
76
+ ```
77
+ sudo journalctl -u matterbridge.service -f --output cat
78
+ ```
79
+
80
+ ### Delete the logs older then 3 days (all of them not only the ones of Matterbridge!)
81
+
82
+ ```
83
+ sudo journalctl --vacuum-time=3d
84
+ ```
85
+
86
+ ### Enable Matterbridge to start automatically on boot
87
+
88
+ ```
89
+ sudo systemctl enable matterbridge.service
90
+ ```
91
+
92
+ ### Disable Matterbridge from starting automatically on boot
93
+
94
+ ```
95
+ sudo systemctl disable matterbridge.service
96
+ ```
97
+
98
+ ## Run matterbridge with docker
99
+
100
+ The Matterbridge Docker image, which includes a manifest list for the linux/amd64, linux/arm64 and linux/arm/v7 architectures, is published on Docker Hub.
101
+
102
+ ### First create the Matterbridge directories
103
+
104
+ This will create the required directories if they don't exist
105
+
106
+ ```
107
+ cd ~
108
+ mkdir -p ./Matterbridge
109
+ mkdir -p ./.matterbridge
110
+ sudo chown -R $USER:$USER ./Matterbridge ./.matterbridge
111
+ ```
112
+ You may need to adapt the script to your setup.
113
+
114
+ ### Run the Docker container and start it
115
+
116
+ The container has full access to the host network (needed for mdns).
117
+
118
+ ```
119
+ docker run --name matterbridge \
120
+ -v ${HOME}/Matterbridge:/root/Matterbridge \
121
+ -v ${HOME}/.matterbridge:/root/.matterbridge \
122
+ --network host --restart always -d luligu/matterbridge:latest
123
+ ```
124
+ You may need to adapt the script to your setup.
125
+
126
+ ### Run with docker compose
127
+
128
+ The docker-compose.yml file is available in the docker directory of the package
129
+
130
+ ```
131
+ services:
132
+ matterbridge:
133
+ container_name: matterbridge
134
+ image: luligu/matterbridge:latest # Matterbridge image with the latest tag
135
+ network_mode: host # Ensures the Matter mdns works
136
+ restart: always # Ensures the container always restarts automatically
137
+ volumes:
138
+ - "${HOME}/Matterbridge:/root/Matterbridge" # Mounts the Matterbridge plugin directory
139
+ - "${HOME}/.matterbridge:/root/.matterbridge" # Mounts the Matterbridge storage directory
140
+ ```
141
+
142
+ copy it in the home directory or edit the existing one to add the matterbridge service.
143
+
144
+ Then start docker compose with:
145
+
146
+ ```
147
+ docker compose up -d
148
+ ```
149
+
150
+ ### Stop with docker compose
151
+
152
+ ```
153
+ docker compose down
154
+ ```
155
+
156
+ ### Update with docker compose
157
+
158
+ ```
159
+ docker compose pull
160
+ ```
161
+
162
+ ### Inspect the container
163
+
164
+ ```
165
+ docker container inspect matterbridge
166
+ ```
167
+
168
+ ### Start the Docker container
169
+
170
+ ```
171
+ docker start matterbridge
172
+ ```
173
+
174
+ ### Stop the Docker container
175
+
176
+ ```
177
+ docker stop matterbridge
178
+ ```
179
+
180
+ ### Restart the Docker container
181
+
182
+ ```
183
+ docker restart matterbridge
184
+ ```
185
+
186
+ ### Shows the logs
187
+
188
+ ```
189
+ docker logs matterbridge
190
+ ```
191
+
192
+ ### Shows the logs real time (tail)
193
+
194
+ ```
195
+ docker logs --tail 1000 -f matterbridge
196
+ ```
197
+
package/README-DEV.md ADDED
@@ -0,0 +1,167 @@
1
+ # <img src="https://github.com/Luligu/matterbridge/blob/main/frontend/public/matterbridge%2064x64.png" alt="Matterbridge Logo" width="64px" height="64px">&nbsp;&nbsp;&nbsp;Matterbridge
2
+
3
+ [![npm version](https://img.shields.io/npm/v/matterbridge.svg)](https://www.npmjs.com/package/matterbridge)
4
+ [![npm downloads](https://img.shields.io/npm/dt/matterbridge.svg)](https://www.npmjs.com/package/matterbridge)
5
+ [![Docker Version](https://img.shields.io/docker/v/luligu/matterbridge?label=docker%20version&sort=semver)](https://hub.docker.com/r/luligu/matterbridge)
6
+ [![Docker Pulls](https://img.shields.io/docker/pulls/luligu/matterbridge.svg)](https://hub.docker.com/r/luligu/matterbridge)
7
+ ![Node.js CI](https://github.com/Luligu/matterbridge/actions/workflows/build.yml/badge.svg)
8
+
9
+ [![power by](https://img.shields.io/badge/powered%20by-matter--history-blue)](https://www.npmjs.com/package/matter-history)
10
+ [![power by](https://img.shields.io/badge/powered%20by-node--ansi--logger-blue)](https://www.npmjs.com/package/node-ansi-logger)
11
+ [![power by](https://img.shields.io/badge/powered%20by-node--persist--manager-blue)](https://www.npmjs.com/package/node-persist-manager)
12
+
13
+ ---
14
+
15
+ # Development
16
+
17
+ ## Guidelines on imports/exports
18
+
19
+ Matterbridge export from:
20
+
21
+ "matterbridge"
22
+ - Matterbridge and MatterbridgeDevice class.
23
+ - All relevant matter-node.js or matter.js classes and functions.
24
+
25
+ "matterbridge/cluster"
26
+ - All clusters not present in matter.js or modified.
27
+
28
+ "matterbridge/utils"
29
+ - All general utils and colorUtils functions.
30
+
31
+ "matterbridge/history"
32
+ - MatterHistory class.
33
+
34
+ "matterbridge/logger"
35
+ - NodeAnsiLogger class.
36
+
37
+ "matterbridge/storage"
38
+ - NodeStorage classes.
39
+
40
+ # **********
41
+ A plugin will never ever install and import from matter-node.js or matter.js directly cause this leads to a second instance of matter.js that causes instability and unpredictable errors like "The only instance is Enpoint".
42
+
43
+ In the next releases I will remove the duplicated exports so please update your plugins.
44
+
45
+ I will also add some error messages when a plugin has wrong imports.
46
+ # **********
47
+
48
+ ## Guidelines on the migration to matter.js V8
49
+
50
+ I'm working with matter.js team to define the strategy for the migration of Matterbridge to the new API.
51
+
52
+ More informations will be added soon.
53
+
54
+ ## How to create your plugin
55
+
56
+ The easiest way is to clone:
57
+
58
+ - https://github.com/Luligu/matterbridge-example-accessory-platform if you want to create an Accessory Platform Plugin.
59
+
60
+ - https://github.com/Luligu/matterbridge-example-dynamic-platform if you want to create a Dynamic Platform Plugin.
61
+
62
+ Then change the name (keep matterbridge- at the beginning of the name), version, description and author in the package.json.
63
+
64
+ Add your plugin logic in platform.ts.
65
+
66
+ ## How to install and register a plugin for development (from github)
67
+
68
+ To install i.e. https://github.com/Luligu/matterbridge-example-accessory-platform
69
+
70
+ On windows:
71
+
72
+ ```
73
+ cd $HOME\Matterbridge
74
+ ```
75
+
76
+ On linux:
77
+
78
+ ```
79
+ cd ~/Matterbridge
80
+ ```
81
+
82
+ then clone the plugin
83
+
84
+ ```
85
+ git clone https://github.com/Luligu/matterbridge-example-accessory-platform
86
+ cd matterbridge-example-accessory-platform
87
+ npm install
88
+ npm run build
89
+ ```
90
+
91
+ then add the plugin to Matterbridge
92
+
93
+ ```
94
+ matterbridge -add .\
95
+ ```
96
+
97
+ ## MatterbridgeDynamicPlatform and MatterbridgeAccessoryPlatform api
98
+
99
+ ### public name: string
100
+
101
+ The plugin name.
102
+
103
+ ### public type: string
104
+
105
+ The plugin platform type.
106
+
107
+ ### public config: object
108
+
109
+ The plugin config (loaded before the platform constructor is called and saved after onShutdown() is called).
110
+ Here you can store your plugin configuration (see matterbridge-zigbee2mqtt for example)
111
+
112
+ ### async onStart(reason?: string)
113
+
114
+ The method onStart() is where you have to create your MatterbridgeDevice and add all needed clusters and command handlers.
115
+
116
+ The MatterbridgeDevice class has the create cluster methods already done and all command handlers needed (see plugin examples).
117
+
118
+ The method is called when Matterbridge load the plugin.
119
+
120
+ ### async onConfigure()
121
+
122
+ The method onConfigure() is where you can configure or initialize your device.
123
+
124
+ The method is called when the platform is commissioned.
125
+
126
+ ### async onShutdown(reason?: string)
127
+
128
+ The method onShutdown() is where you have to eventually cleanup some resources.
129
+
130
+ The method is called when Matterbridge is shutting down.
131
+
132
+ ### async registerDevice(device: MatterbridgeDevice)
133
+
134
+ After you created your device, add it to the platform.
135
+
136
+ ### async unregisterDevice(device: MatterbridgeDevice)
137
+
138
+ You can unregister one or more device.
139
+
140
+ ### async unregisterAllDevices()
141
+
142
+ You can unregister all devices you added.
143
+
144
+ It can be useful to call this method from onShutdown() if you don't want to keep all the devices during development.
145
+
146
+ ## MatterbridgeDevice api
147
+
148
+ Work in progress...
149
+
150
+ # Contribution Guidelines
151
+
152
+ Thank you for your interest in contributing to my project!
153
+
154
+ I warmly welcome contributions to this project! Whether it's reporting bugs, proposing new features, updating documentation, or writing code, your help is greatly appreciated.
155
+
156
+ ## Getting Started
157
+
158
+ - Fork this repository to your own GitHub account and clone it to your local device.
159
+ - Make the necessary changes and test them out
160
+ - Commit your changes and push to your forked repository
161
+
162
+ ## Submitting Changes
163
+
164
+ - Create a new pull request against the dev from my repository and I'll be glad to check it out
165
+ - Be sure to follow the existing code style
166
+ - Add unit tests for any new or changed functionality if possible
167
+ - In your pull request, do describe what your changes do and how they work