matterbridge-irobot 0.0.3 → 0.0.4-dev-20260409-d3ea264

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
@@ -6,6 +6,26 @@ If you like this project and find it useful, please consider giving it a **star*
6
6
 
7
7
  <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="120"></a>
8
8
 
9
+ ## [0.0.4] - Dev branch
10
+
11
+ ### Added
12
+
13
+ - [logger]: Add logger level and log on file for the plugin and all devices.
14
+ - [select]: Add select for the platform.
15
+
16
+ ### Changed
17
+
18
+ - [package]: Update dependencies.
19
+ - [package]: Bump package to `automator` v.3.1.5.
20
+ - [package]: Bump `eslint` to v.10.2.0.
21
+ - [package]: Bump `typescript-eslint` to v.8.58.1.
22
+ - [devcontainer]: Fix pull of new image.
23
+ - [devcontainer]: Update VS Code settings.
24
+ - [devcontainer]: Leave matterbridge scripts in the cloned repo.
25
+ - [scripts]: Update mb-run script.
26
+
27
+ <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
28
+
9
29
  ## [0.0.3] - 2026-03-27
10
30
 
11
31
  First published release. It requires matterbridge v.3.7.1.
package/README.md CHANGED
@@ -7,10 +7,10 @@
7
7
  ![Node.js CI](https://github.com/Luligu/matterbridge-irobot/actions/workflows/build.yml/badge.svg)
8
8
  ![CodeQL](https://github.com/Luligu/matterbridge-irobot/actions/workflows/codeql.yml/badge.svg)
9
9
  [![codecov](https://codecov.io/gh/Luligu/matterbridge-irobot/branch/main/graph/badge.svg)](https://codecov.io/gh/Luligu/matterbridge-irobot)
10
- [![styled with prettier](https://img.shields.io/badge/styled_with-Prettier-f8bc45.svg?logo=prettier)](https://github.com/prettier/prettier)
11
- [![linted with eslint](https://img.shields.io/badge/linted_with-ES_Lint-4B32C3.svg?logo=eslint)](https://github.com/eslint/eslint)
10
+ [![styled with prettier](https://img.shields.io/badge/styled_with-Prettier-f8bc45.svg?logo=prettier)](https://prettier.io/)
11
+ [![linted with eslint](https://img.shields.io/badge/linted_with-ES_Lint-4B32C3.svg?logo=eslint)](https://eslint.org/)
12
12
  [![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
13
- [![ESM](https://img.shields.io/badge/ESM-Node.js-339933?logo=node.js&logoColor=white)](https://nodejs.org/api/esm.html)
13
+ [![ESM](https://img.shields.io/badge/ESM-Node.js-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
14
14
  [![matterbridge.io](https://img.shields.io/badge/matterbridge.io-online-brightgreen)](https://matterbridge.io)
15
15
 
16
16
  [![powered by](https://img.shields.io/badge/powered%20by-matterbridge-blue)](https://www.npmjs.com/package/matterbridge)
package/dist/module.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { mkdirSync } from 'node:fs';
2
+ import path from 'node:path';
1
3
  import { inspect } from 'node:util';
2
4
  import { MatterbridgeDynamicPlatform } from 'matterbridge';
3
5
  import { RoboticVacuumCleaner } from 'matterbridge/devices';
@@ -19,19 +21,26 @@ export class Platform extends MatterbridgeDynamicPlatform {
19
21
  if (this.verifyMatterbridgeVersion === undefined || typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.7.1')) {
20
22
  throw new Error(`This plugin requires Matterbridge version >= "3.7.1". Please update Matterbridge to the latest version in the frontend.`);
21
23
  }
22
- this.log.info('Initializing platform:', this.config.name);
23
24
  this.config.discovery = this.config.discovery ?? true;
24
25
  this.config.whiteList = this.config.whiteList ?? [];
25
26
  this.config.blackList = this.config.blackList ?? [];
26
27
  this.config.devices = this.config.devices ?? [];
27
28
  this.config.enableServerRvc = this.config.enableServerRvc ?? true;
28
29
  this.config.debug = this.config.debug ?? false;
30
+ this.config.logLevel = this.config.logLevel ?? "info";
31
+ this.config.logOnFile = this.config.logOnFile ?? false;
29
32
  this.config.unregisterOnShutdown = this.config.unregisterOnShutdown ?? false;
33
+ if (this.config.logOnFile) {
34
+ mkdirSync(path.join(matterbridge.matterbridgePluginDirectory, this.config.name), { recursive: true });
35
+ this.log.logFilePath = path.join(matterbridge.matterbridgePluginDirectory, this.config.name, this.config.name + '.log');
36
+ }
37
+ this.log.info('Initializing platform:', this.config.name);
30
38
  this.log.info('Finished initializing platform:', this.config.name);
31
39
  }
32
40
  async onStart(reason) {
33
41
  this.log.info('onStart called with reason:', reason ?? 'none');
34
42
  await this.ready;
43
+ await this.clearSelect();
35
44
  if (this.config.discovery)
36
45
  await this.discoverDevices();
37
46
  await this.registerDevices();
@@ -124,6 +133,9 @@ export class Platform extends MatterbridgeDynamicPlatform {
124
133
  async registerDevices(timeout = 3000) {
125
134
  for (const device of this.config.devices) {
126
135
  this.log.info(`Registering device "${device.name}" with IP ${device.ip}...`);
136
+ this.setSelectDevice(device.ip ?? 'unknown-ip-' + device.name.toLowerCase().replaceAll(' ', '-'), device.name);
137
+ if (!this.validateDevice(device.name, true))
138
+ continue;
127
139
  if (device.ip) {
128
140
  try {
129
141
  this.log.info(`Getting public info for device "${device.name}" with IP ${device.ip}...`);
@@ -151,6 +163,10 @@ export class Platform extends MatterbridgeDynamicPlatform {
151
163
  const rvc = new RoboticVacuumCleaner(device.name, device.ip ?? device.name.toLocaleLowerCase().replaceAll(' ', '-') + '-unknown-ip', this.config.enableServerRvc ? 'server' : undefined, runMode, runModes, cleanMode, cleanModes, phase, phases, RvcOperationalState.OperationalState.Docked, undefined, supportedAreas, selectedAreas, currentArea, supportedMaps);
152
164
  await this.registerDevice(rvc);
153
165
  await rvc.construction.ready;
166
+ rvc.log.logLevel = this.config.logLevel;
167
+ if (this.config.logOnFile) {
168
+ rvc.log.logFilePath = path.join(this.matterbridge.matterbridgePluginDirectory, this.config.name, device.name.toLowerCase().replaceAll(' ', '-') + '.log');
169
+ }
154
170
  await rvc.setAttribute(PowerSource.Cluster.with(PowerSource.Feature.Battery), 'batChargeLevel', PowerSource.BatChargeLevel.Ok);
155
171
  await rvc.setAttribute(PowerSource.Cluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), 'batChargeState', PowerSource.BatChargeState.IsAtFullCharge);
156
172
  await rvc.setAttribute(PowerSource.Cluster.with(PowerSource.Feature.Battery), 'batReplaceability', PowerSource.BatReplaceability.UserReplaceable);
@@ -8,5 +8,7 @@
8
8
  "blackList": [],
9
9
  "enableServerRvc": true,
10
10
  "debug": false,
11
+ "logLevel": "info",
12
+ "logOnFile": false,
11
13
  "unregisterOnShutdown": false
12
14
  }
@@ -45,9 +45,9 @@
45
45
  },
46
46
  "discovery": {
47
47
  "title": "iRobot Discovery",
48
- "description": "iRobot discovery of new devices on startup.",
48
+ "description": "iRobot discovery of new devices on startup. Once the devices are discovered, you can disable discovery to speed up the startup time.",
49
49
  "type": "boolean",
50
- "ui:widget": "checkbox"
50
+ "default": true
51
51
  },
52
52
  "devices": {
53
53
  "title": "Devices",
@@ -106,7 +106,7 @@
106
106
  },
107
107
  "enableServerRvc": {
108
108
  "title": "Enable Server RVC",
109
- "description": "Enable the Robot Vacuum Cleaner in server mode (Apple Home will crash unless you use this mode!)",
109
+ "description": "Enable the Robot Vacuum Cleaner in server mode. It is mandatory with Apple Home (Apple Home will crash unless you use this mode!)",
110
110
  "type": "boolean",
111
111
  "default": true
112
112
  },
@@ -114,6 +114,20 @@
114
114
  "title": "Enable Debug",
115
115
  "description": "Enable the debug for the plugin (development only)",
116
116
  "type": "boolean",
117
+ "default": false,
118
+ "ui:widget": "hidden"
119
+ },
120
+ "logLevel": {
121
+ "title": "Log Level",
122
+ "description": "Set the log level for the plugin logger and all devices loggers.",
123
+ "type": "string",
124
+ "default": "info",
125
+ "enum": ["debug", "info", "notice", "warn", "error", "fatal"]
126
+ },
127
+ "logOnFile": {
128
+ "title": "Log On File",
129
+ "description": "Enable logging to file for the plugin logger and all devices loggers. The log files will be stored in the matterbridge plugin directory.",
130
+ "type": "boolean",
117
131
  "default": false
118
132
  },
119
133
  "unregisterOnShutdown": {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge-irobot",
3
- "version": "0.0.3",
3
+ "version": "0.0.4-dev-20260409-d3ea264",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge-irobot",
9
- "version": "0.0.3",
9
+ "version": "0.0.4-dev-20260409-d3ea264",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "mqtt": "5.15.1",
@@ -31,9 +31,9 @@
31
31
  }
32
32
  },
33
33
  "node_modules/@types/node": {
34
- "version": "25.5.0",
35
- "resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.0.tgz",
36
- "integrity": "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==",
34
+ "version": "25.5.2",
35
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.2.tgz",
36
+ "integrity": "sha512-tO4ZIRKNC+MDWV4qKVZe3Ql/woTnmHDr5JD8UI5hn2pwBrHEwOEMZK7WlNb5RKB6EoJ02gwmQS9OrjuFnZYdpg==",
37
37
  "license": "MIT",
38
38
  "dependencies": {
39
39
  "undici-types": "~7.18.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge-irobot",
3
- "version": "0.0.3",
3
+ "version": "0.0.4-dev-20260409-d3ea264",
4
4
  "description": "Matterbridge iRobot plugin",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",
@@ -69,8 +69,7 @@
69
69
  "node-persist-manager": "2.0.1"
70
70
  },
71
71
  "overrides": {
72
- "typescript": "6.0.2",
73
- "eslint": "10.1.0",
72
+ "eslint": "10.2.0",
74
73
  "@eslint/js": "10.0.1"
75
74
  }
76
75
  }