matterbridge-eve-motion 1.0.3 → 1.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ <a href="https://www.buymeacoffee.com/luligugithub">
6
+ <img src="./yellow-button.png" alt="Buy me a coffee" width="120">
7
+ </a>
8
+
9
+ <!-- Commented out section
10
+ ## [1.1.2] - 2024-03-08
11
+
12
+ ### Added
13
+
14
+ - [Feature 1]: Description of the feature.
15
+ - [Feature 2]: Description of the feature.
16
+
17
+ ### Changed
18
+
19
+ - [Feature 3]: Description of the change.
20
+ - [Feature 4]: Description of the change.
21
+
22
+ ### Deprecated
23
+
24
+ - [Feature 5]: Description of the deprecation.
25
+
26
+ ### Removed
27
+
28
+ - [Feature 6]: Description of the removal.
29
+
30
+ ### Fixed
31
+
32
+ - [Bug 1]: Description of the bug fix.
33
+ - [Bug 2]: Description of the bug fix.
34
+
35
+ ### Security
36
+
37
+ - [Security 1]: Description of the security improvement.
38
+ -->
package/README.md CHANGED
@@ -10,13 +10,12 @@
10
10
 
11
11
  ---
12
12
 
13
- This plugin shows how to use the Matter history and how to create passive device in matter.js.
13
+ This plugin shows how to use the Matter history and how to create a passive device in matter.js.
14
14
 
15
- It create a motion sensor with a light sensor device that continuously changes state.
15
+ It create a virtual motion sensor with a light sensor device that continuously changes state.
16
16
 
17
17
  ## Prerequisites
18
18
 
19
19
  ### Matterbridge
20
20
 
21
21
  See the guidelines on [Matterbridge](https://github.com/Luligu/matterbridge/blob/main/README.md) for more information.
22
-
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Matterbridge, PlatformConfig } from 'matterbridge';
2
- import { AnsiLogger } from 'node-ansi-logger';
2
+ import { AnsiLogger } from 'matterbridge/logger';
3
3
  import { EveMotionPlatform } from './platform.js';
4
4
  /**
5
5
  * This is the standard interface for MatterBridge plugins.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,YAAY,EAAE,YAAY,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,qBAE3G"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,YAAY,EAAE,YAAY,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,qBAE3G"}
@@ -1,7 +1,6 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import { PlatformConfig } from 'matterbridge';
3
- import { Matterbridge, MatterbridgeDevice, MatterbridgeAccessoryPlatform, MatterHistory } from 'matterbridge';
4
- import { AnsiLogger } from 'node-ansi-logger';
1
+ import { PlatformConfig, Matterbridge, MatterbridgeDevice, MatterbridgeAccessoryPlatform } from 'matterbridge';
2
+ import { MatterHistory } from 'matterbridge/history';
3
+ import { AnsiLogger } from 'matterbridge/logger';
5
4
  export declare class EveMotionPlatform extends MatterbridgeAccessoryPlatform {
6
5
  motion: MatterbridgeDevice | undefined;
7
6
  history: MatterHistory | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.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@
1
- import { DeviceTypes, IlluminanceMeasurement, OccupancySensing } from 'matterbridge';
2
- import { MatterbridgeDevice, MatterbridgeAccessoryPlatform, MatterHistory } from 'matterbridge';
1
+ import { DeviceTypes, IlluminanceMeasurement, OccupancySensing, MatterbridgeDevice, MatterbridgeAccessoryPlatform, powerSource } from 'matterbridge';
2
+ import { MatterHistory } from 'matterbridge/history';
3
3
  export class EveMotionPlatform extends MatterbridgeAccessoryPlatform {
4
4
  motion;
5
5
  history;
@@ -16,10 +16,10 @@ export class EveMotionPlatform extends MatterbridgeAccessoryPlatform {
16
16
  this.motion.createDefaultOccupancySensingClusterServer();
17
17
  this.motion.addDeviceType(DeviceTypes.LIGHT_SENSOR);
18
18
  this.motion.createDefaultIlluminanceMeasurementClusterServer();
19
+ this.motion.addDeviceType(powerSource);
19
20
  this.motion.createDefaultPowerSourceReplaceableBatteryClusterServer();
20
- this.motion.createDefaultPowerSourceConfigurationClusterServer(1);
21
21
  // Add the EveHistory cluster to the device as last cluster!
22
- this.motion.createMotionEveHistoryClusterServer(this.history, this.log);
22
+ this.history.createMotionEveHistoryClusterServer(this.motion, this.log);
23
23
  this.history.autoPilot(this.motion);
24
24
  await this.registerDevice(this.motion);
25
25
  this.motion.addCommandHandler('identify', async ({ request: { identifyTime } }) => {
@@ -48,7 +48,8 @@ export class EveMotionPlatform extends MatterbridgeAccessoryPlatform {
48
48
  this.log.info('onShutdown called with reason:', reason ?? 'none');
49
49
  await this.history?.close();
50
50
  clearInterval(this.interval);
51
- await this.unregisterAllDevices();
51
+ if (this.config.unregisterOnShutdown === true)
52
+ await this.unregisterAllDevices();
52
53
  }
53
54
  }
54
55
  //# sourceMappingURL=platform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,gBAAgB,EAAkB,MAAM,cAAc,CAAC;AAErG,OAAO,EAAgB,kBAAkB,EAA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CAAC,CAAC,CAAC,CAAC,CAAC;YAEvK,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;YAC5B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;YACtG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAiB,SAAS,CAAC,QAAQ,eAAe,GAAG,EAAE,CAAC,CAAC;QACzE,CAAC,EACD,EAAE,GAAG,IAAI,GAAG,GAAG,CAChB,CAAC;IACJ,CAAC;IAEQ,KAAK,CAAC,UAAU,CAAC,MAAe;QACvC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,gCAAgC,EAAE,MAAM,IAAI,MAAM,CAAC,CAAC;QAClE,MAAM,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,IAAI,IAAI,CAAC,MAAM,CAAC,oBAAoB,KAAK,IAAI;YAAE,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC;IACnF,CAAC;CACF"}
@@ -0,0 +1,78 @@
1
+ // @ts-check
2
+
3
+ import eslint from '@eslint/js';
4
+ import tseslint from 'typescript-eslint';
5
+ import jesteslint from 'eslint-plugin-jest';
6
+ import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
7
+
8
+ export default [
9
+ {
10
+ name: 'global ignores',
11
+ ignores: ['dist/', 'build/', 'node_modules/', 'coverage/', 'frontend/'],
12
+ },
13
+ eslint.configs.recommended,
14
+ ...tseslint.configs.strict,
15
+ ...tseslint.configs.stylistic,
16
+ // ...tseslint.configs.strictTypeChecked,
17
+ // ...tseslint.configs.stylisticTypeChecked,
18
+ eslintPluginPrettier,
19
+ {
20
+ languageOptions: {
21
+ ecmaVersion: 'latest',
22
+ sourceType: 'module',
23
+ /*
24
+ parser: tseslint.parser,
25
+ parserOptions: {
26
+ project: './tsconfig.eslint.json',
27
+ tsconfigRootDir: import.meta.dirname,
28
+ },
29
+ */
30
+ },
31
+ linterOptions: {
32
+ reportUnusedDisableDirectives: 'warn',
33
+ },
34
+ rules: {
35
+ 'no-console': 'warn',
36
+ 'no-undef': 'off',
37
+ 'spaced-comment': ['error', 'always'],
38
+ 'no-useless-constructor': 'off',
39
+ },
40
+ },
41
+ {
42
+ name: 'javascript',
43
+ files: ['**/*.js'],
44
+ // ...tseslint.configs.disableTypeChecked,
45
+ },
46
+ {
47
+ name: 'typescript',
48
+ files: ['**/*.ts'],
49
+ ignores: ['**/__test__/*', '**/*.test.ts', '**/*.spec.ts'],
50
+ languageOptions: {
51
+ ecmaVersion: 'latest',
52
+ sourceType: 'module',
53
+ parser: tseslint.parser,
54
+ parserOptions: {
55
+ project: './tsconfig.json',
56
+ tsconfigRootDir: import.meta.dirname,
57
+ },
58
+ },
59
+ plugins: {
60
+ '@typescript-eslint': tseslint.plugin,
61
+ },
62
+ rules: {
63
+ '@typescript-eslint/no-useless-constructor': 'off',
64
+ },
65
+ },
66
+ {
67
+ name: 'jest',
68
+ files: ['**/__test__/*', '**/*.test.ts', '**/*.spec.ts'],
69
+ // ...tseslint.configs.disableTypeChecked,
70
+ plugins: {
71
+ '@typescript-eslint': tseslint.plugin,
72
+ jest: jesteslint,
73
+ },
74
+ rules: {
75
+ ...jesteslint.configs['flat/recommended'].rules,
76
+ },
77
+ },
78
+ ];
package/jest.config.js ADDED
@@ -0,0 +1,29 @@
1
+ // jest.config.js
2
+ /*
3
+
4
+ How to install:
5
+ npm install --save-dev jest ts-jest @types/jest eslint-plugin-jest
6
+
7
+ Add package.json scripts:
8
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
9
+ "test:verbose": "node --experimental-vm-modules node_modules/jest/bin/jest.js --verbose",
10
+ "test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
11
+
12
+ */
13
+
14
+ export default {
15
+ testEnvironment: 'node',
16
+ extensionsToTreatAsEsm: ['.ts'],
17
+ moduleNameMapper: {
18
+ '^(\\.{1,2}/.*)\\.js$': '$1',
19
+ },
20
+ transform: {
21
+ '^.+\\.ts$': [
22
+ 'ts-jest',
23
+ {
24
+ useESM: true,
25
+ },
26
+ ],
27
+ },
28
+ transformIgnorePatterns: ['/node_modules/'],
29
+ };
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-console */
1
2
  import { exec } from 'child_process';
2
3
 
3
4
  const command = process.platform === 'win32' ? 'npm link matterbridge' : 'sudo npm link matterbridge';
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge-eve-motion",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Matterbridge eve motion with history",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
- "types": "dist/index.d.js",
9
+ "types": "dist/index.d.ts",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "git+https://github.com/Luligu/matterbridge-eve-motion.git"
@@ -32,19 +32,20 @@
32
32
  "watch": "tsc --watch",
33
33
  "start:bridge": "matterbridge -bridge",
34
34
  "start:childbridge": "matterbridge -childbridge",
35
- "test": "jest",
36
- "test:verbose": "jest --verbose",
37
- "test:watch": "jest --watch",
38
- "lint": "eslint src/**.ts",
39
- "lint:fix": "eslint src/**.ts --fix",
40
- "format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,md}\"",
41
- "format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx,json,css,md}\"",
35
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --passWithNoTests",
36
+ "test:verbose": "node --experimental-vm-modules node_modules/jest/bin/jest.js --passWithNoTests --verbose",
37
+ "test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --passWithNoTests --watch",
38
+ "lint": "eslint --max-warnings=0 .",
39
+ "lint:fix": "eslint --fix --max-warnings=0 .",
40
+ "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
41
+ "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
42
42
  "clean": "rimraf tsconfig.tsbuildinfo ./dist",
43
43
  "cleanBuild": "npm run clean && tsc",
44
- "deepClean": "rimraf tsconfig.tsbuildinfo package-lock.json ./dist ./node_modules",
44
+ "deepClean": "rimraf tsconfig.tsbuildinfo package-lock.json ./dist ./node_modulesI",
45
+ "deepCleanRebuild": "npm run deepClean && npm install && npm run build",
45
46
  "prepublishOnly": "npm run lint && npm run cleanBuild",
46
47
  "checkDependencies": "npx npm-check-updates",
47
- "updateDependencies": "npx npm-check-updates -u",
48
+ "updateDependencies": "npx npm-check-updates -u && npm install & npm run cleanBuild",
48
49
  "matterbridge:add": "matterbridge -add .\\",
49
50
  "matterbridge:remove": "matterbridge -remove .\\",
50
51
  "matterbridge:enable": "matterbridge -enable .\\",
@@ -55,18 +56,26 @@
55
56
  "dev:uninstall": "npm uninstall matterbridge && npm unlink matterbridge",
56
57
  "install": "node link-matterbridge-script.js"
57
58
  },
59
+ "overrides": {
60
+ "eslint": "latest"
61
+ },
58
62
  "devDependencies": {
59
- "@stylistic/eslint-plugin": "^1.7.0",
60
- "@tsconfig/node-lts": "^20.1.3",
61
- "@types/node": "^20.12.2",
62
- "@typescript-eslint/eslint-plugin": "^7.4.0",
63
- "@typescript-eslint/parser": "^7.4.0",
63
+ "@eslint/js": "^9.6.0",
64
+ "@types/eslint__js": "^8.42.3",
65
+ "@types/jest": "^29.5.12",
66
+ "@types/node": "^20.14.10",
64
67
  "eslint-config-prettier": "^9.1.0",
68
+ "eslint-plugin-jest": "^28.6.0",
65
69
  "eslint-plugin-prettier": "^5.1.3",
66
- "prettier": "^3.2.5",
67
- "typescript": "^5.4.3"
70
+ "jest": "^29.7.0",
71
+ "prettier": "^3.3.2",
72
+ "rimraf": "^6.0.0",
73
+ "ts-jest": "^29.2.1",
74
+ "typescript": "^5.5.3",
75
+ "typescript-eslint": "^7.16.0"
68
76
  },
69
77
  "dependencies": {
70
- "node-ansi-logger": "^1.9.3"
78
+ "node-ansi-logger": "^1.9.5",
79
+ "node-persist-manager": "^1.0.7"
71
80
  }
72
- }
81
+ }
@@ -0,0 +1,49 @@
1
+ // @ts-check
2
+ /*
3
+
4
+ prettier.config.js
5
+
6
+ Prettier:
7
+
8
+ How to install:
9
+ npm install --save-dev prettier eslint-config-prettier eslint-plugin-prettier
10
+
11
+
12
+ Add package.json scripts:
13
+ */
14
+ // "format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,md}\"",
15
+ // "format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx,json,css,md}\"",
16
+
17
+ /*
18
+
19
+ Add .prettierignore
20
+
21
+ # Ignore artifacts:
22
+ dist
23
+ node_modules
24
+ build
25
+ coverage
26
+
27
+ # Ignore all HTML files:
28
+ */
29
+ // **/*.html
30
+
31
+ export default {
32
+ printWidth: 180, // default 80
33
+ tabWidth: 2,
34
+ useTabs: false,
35
+ semi: true,
36
+ singleQuote: true, // default false
37
+ quoteProps: 'preserve', // default 'as-needed'
38
+ jsxSingleQuote: false,
39
+ trailingComma: 'all',
40
+ bracketSpacing: true,
41
+ bracketSameLine: false,
42
+ arrowParens: 'always',
43
+ requirePragma: false,
44
+ insertPragma: false,
45
+ proseWrap: 'preserve',
46
+ endOfLine: 'lf',
47
+ embeddedLanguageFormatting: 'off', // default 'auto'
48
+ singleAttributePerLine: false,
49
+ };
Binary file