matterbridge-eve-energy 1.3.1-dev-20250730-06dc1db → 2.0.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
@@ -17,6 +17,28 @@
17
17
 
18
18
  All notable changes to this project will be documented in this file.
19
19
 
20
+ ## [2.0.0] - 2025-10-24
21
+
22
+ ### Changed
23
+
24
+ - [package]: Bumped platform to v. 2.0.0.
25
+ - [package]: Updated dependencies.
26
+ - [package]: Bumped package to automator v. 2.0.9
27
+ - [jest]: Updated jestHelpers to v. 1.0.9.
28
+ - [package]: Require matterbridge 3.3.0.
29
+ - [index]: Updated to new signature PlatformMatterbridge.
30
+ - [platform]: Updated to new signature PlatformMatterbridge.
31
+ - [workflows]: Ignore any .md in build.yaml.
32
+ - [workflows]: Ignore any .md in codeql.yaml.
33
+ - [workflows]: Ignore any .md in codecov.yaml.
34
+ - [workflows]: Improved speed on Node CI.
35
+ - [devcontainer]: Added the plugin name to the container.
36
+ - [devcontainer]: Improved performance of first build with shallow clone.
37
+
38
+ <a href="https://www.buymeacoffee.com/luligugithub">
39
+ <img src="bmc-button.svg" alt="Buy me a coffee" width="80">
40
+ </a>
41
+
20
42
  ## [1.3.1] - 2025-07-29
21
43
 
22
44
  ### Added
@@ -1,14 +1,18 @@
1
- import { MatterHistory } from 'matter-history';
1
+ import { EveHistory, MatterHistory } from 'matter-history';
2
2
  import { MatterbridgeAccessoryPlatform, powerSource, MatterbridgeEndpoint, onOffOutlet } from 'matterbridge';
3
3
  import { OnOff } from 'matterbridge/matter/clusters';
4
+ export default function initializePlugin(matterbridge, log, config) {
5
+ return new EveEnergyPlatform(matterbridge, log, config);
6
+ }
4
7
  export class EveEnergyPlatform extends MatterbridgeAccessoryPlatform {
5
8
  energy;
6
9
  history;
7
10
  interval;
11
+ state = false;
8
12
  constructor(matterbridge, log, config) {
9
13
  super(matterbridge, log, config);
10
- if (this.verifyMatterbridgeVersion === undefined || typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.0.0')) {
11
- throw new Error(`This plugin requires Matterbridge version >= "3.0.0". Please update Matterbridge from ${this.matterbridge.matterbridgeVersion} to the latest version in the frontend."`);
14
+ if (this.verifyMatterbridgeVersion === undefined || typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.3.0')) {
15
+ throw new Error(`This plugin requires Matterbridge version >= "3.3.0". Please update Matterbridge from ${this.matterbridge.matterbridgeVersion} to the latest version in the frontend."`);
12
16
  }
13
17
  this.log.info('Initializing platform:', this.config.name);
14
18
  }
@@ -35,19 +39,22 @@ export class EveEnergyPlatform extends MatterbridgeAccessoryPlatform {
35
39
  }
36
40
  async onConfigure() {
37
41
  this.log.info('onConfigure called');
38
- this.interval = setInterval(() => {
42
+ this.interval = setInterval(async () => {
39
43
  if (!this.energy || !this.history)
40
44
  return;
41
- let state = this.energy.getAttribute(OnOff.Cluster.id, 'onOff', this.log);
42
- state = !state;
45
+ this.state = !this.state;
43
46
  const voltage = this.history.getFakeLevel(210, 235, 2);
44
- const current = state === true ? this.history.getFakeLevel(0.05, 10.5, 2) : 0;
45
- const power = state === true ? this.history.getFakeLevel(0.5, 1550, 2) : 0;
47
+ const current = this.state === true ? this.history.getFakeLevel(0.05, 10.5, 2) : 0;
48
+ const power = this.state === true ? this.history.getFakeLevel(0.5, 1550, 2) : 0;
46
49
  const consumption = this.history.getFakeLevel(0.5, 1550, 2);
47
- this.energy.setAttribute(OnOff.Cluster.id, 'onOff', state, this.log);
50
+ await this.energy.setAttribute(OnOff.Cluster.id, 'onOff', this.state, this.log);
51
+ await this.energy.setAttribute(EveHistory.Cluster.id, 'voltage', voltage, this.log);
52
+ await this.energy.setAttribute(EveHistory.Cluster.id, 'current', current, this.log);
53
+ await this.energy.setAttribute(EveHistory.Cluster.id, 'consumption', power, this.log);
54
+ await this.energy.setAttribute(EveHistory.Cluster.id, 'totalConsumption', consumption, this.log);
48
55
  this.history.setLastEvent();
49
- this.history.addEntry({ time: this.history.now(), status: state === true ? 1 : 0, voltage, current, power, consumption });
50
- this.log.info(`Set state to ${state} voltage:${voltage} current:${current} power:${power} consumption:${consumption}`);
56
+ this.history.addEntry({ time: this.history.now(), status: this.state === true ? 1 : 0, voltage, current, power, consumption });
57
+ this.log.info(`Set state to ${this.state} voltage:${voltage} current:${current} power:${power} consumption:${consumption}`);
51
58
  }, 60 * 1000 - 200);
52
59
  }
53
60
  async onShutdown(reason) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge-eve-energy",
3
- "version": "1.3.1-dev-20250730-06dc1db",
3
+ "version": "2.0.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge-eve-energy",
9
- "version": "1.3.1-dev-20250730-06dc1db",
9
+ "version": "2.0.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "matter-history": "1.1.19",
@@ -14,7 +14,7 @@
14
14
  "node-persist-manager": "2.0.0"
15
15
  },
16
16
  "engines": {
17
- "node": ">=18.0.0 <19.0.0 || >=20.0.0 <21.0.0 || >=22.0.0 <23.0.0 || >=24.0.0 <25.0.0"
17
+ "node": ">=20.0.0 <21.0.0 || >=22.0.0 <23.0.0 || >=24.0.0 <25.0.0"
18
18
  },
19
19
  "funding": {
20
20
  "type": "buymeacoffee",
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "matterbridge-eve-energy",
3
- "version": "1.3.1-dev-20250730-06dc1db",
3
+ "version": "2.0.0",
4
4
  "description": "Matterbridge eve energy with history",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",
7
7
  "type": "module",
8
- "main": "dist/index.js",
8
+ "main": "dist/module.js",
9
9
  "homepage": "https://www.npmjs.com/package/matterbridge-eve-energy",
10
10
  "repository": {
11
11
  "type": "git",
@@ -29,7 +29,7 @@
29
29
  "history"
30
30
  ],
31
31
  "engines": {
32
- "node": ">=18.0.0 <19.0.0 || >=20.0.0 <21.0.0 || >=22.0.0 <23.0.0 || >=24.0.0 <25.0.0"
32
+ "node": ">=20.0.0 <21.0.0 || >=22.0.0 <23.0.0 || >=24.0.0 <25.0.0"
33
33
  },
34
34
  "dependencies": {
35
35
  "matter-history": "1.1.19",
package/dist/index.js DELETED
@@ -1,4 +0,0 @@
1
- import { EveEnergyPlatform } from './platform.js';
2
- export default function initializePlugin(matterbridge, log, config) {
3
- return new EveEnergyPlatform(matterbridge, log, config);
4
- }
package/yellow-button.png DELETED
Binary file