homebridge-smartsystem 7.1.16 → 7.1.19

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.
@@ -773,9 +773,9 @@ class Master extends base_1.Base {
773
773
  }
774
774
  setRegisterValue(register, value) {
775
775
  return __awaiter(this, void 0, void 0, function* () {
776
- this.log(`### setRegisterValue called: register=${register}, value=${value}, protocol=${this.protocol}`);
776
+ this.info(`### setRegisterValue called: register=${register}, value=${value}, protocol=${this.protocol}`);
777
777
  if (this.protocol >= 209) {
778
- this.log(`### Sending register update to ${this.getAddress()}: register ${register} = ${value}`);
778
+ this.info(`### Sending register update to ${this.getAddress()}: register ${register} = ${value}`);
779
779
  yield this.send(protocol_1.Protocol.buildRegister(register, value));
780
780
  this.log(`### Register ${register} set to ${value} successfully`);
781
781
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-smartsystem",
3
3
  "displayname": "Duotecno Bridge",
4
- "version": "7.1.16",
4
+ "version": "7.1.19",
5
5
  "description": "SmartServer (Proxy TCP sockets to the cloud, Smappee MQTT, Duotecno IP Nodes, Homekit interface)",
6
6
  "main": "index.js",
7
7
  "author": "Johan Coppieters",
@@ -13,9 +13,10 @@
13
13
  "build": "npx tsc --build",
14
14
  "unpublish": "npm unpublish --force homebridge-smartsystem@6.8.17",
15
15
  "prepublishOnly": "npm run build",
16
- "release:patch": "echo 'npm login !!' && git add -A && git commit -m 'pre-release' --allow-empty && npm version patch && npm publish && git push && git push --tags",
17
- "release:minor": "echo 'npm login !!' && git add -A && git commit -m 'pre-release' --allow-empty && npm version minor && npm publish && git push && git push --tags",
18
- "release:major": "git add -A && git commit -m 'pre-release' --allow-empty && npm version major && npm publish && git push && git push --tags"
16
+ "check-published": "npm view homebridge-smartsystem version",
17
+ "release:patch": "echo 'npm login !!' && git add -A && git commit -m 'pre-release' --allow-empty && npm version patch && npm publish && git push && git push --tags && echo 'Waiting for npm to propagate...' && sleep 5 && npm run check-published",
18
+ "release:minor": "echo 'npm login !!' && git add -A && git commit -m 'pre-release' --allow-empty && npm version minor && npm publish && git push && git push --tags && echo 'Waiting for npm to propagate...' && sleep 5 && npm run check-published",
19
+ "release:major": "git add -A && git commit -m 'pre-release' --allow-empty && npm version major && npm publish && git push && git push --tags && echo 'Waiting for npm to propagate...' && sleep 5 && npm run check-published"
19
20
  },
20
21
  "engines": {
21
22
  "node": "^18.20.4 || ^20.15.1 || ^22",
@@ -108,12 +108,15 @@ class PowerBase extends base_1.Base {
108
108
  // no previous value -> always update
109
109
  if (isNaN(previous))
110
110
  return true;
111
- // less than 1000W -> update on: difference > 5% previous
112
- if (current < 1000)
113
- return Math.abs(previous - current) > (previous * 0.05);
114
- // more than 1000W -> update on: difference > 2% previous
115
- if (current >= 1000)
116
- return Math.abs(previous - current) > (previous * 0.02);
111
+ const absCurrent = Math.abs(current);
112
+ const absPrevious = Math.abs(previous);
113
+ const diff = Math.abs(previous - current);
114
+ // less than 1000W -> update on: difference > 5% of previous absolute value
115
+ if (absCurrent < 1000)
116
+ return diff > (absPrevious * 0.05);
117
+ // more than 1000W -> update on: difference > 2% of previous absolute value
118
+ if (absCurrent >= 1000)
119
+ return diff > (absPrevious * 0.02);
117
120
  return false;
118
121
  }
119
122
  applyBindings() {
@@ -138,7 +141,7 @@ class PowerBase extends base_1.Base {
138
141
  });
139
142
  }
140
143
  else {
141
- (0, logger_1.debug)("power", `[Binding ${idx}] NOT significant for channel ${b.channel} -> register ${b.register}: ${currentValue}W -> ${power}W (diff: ${Math.abs(currentValue - power)}W, threshold: ${currentValue < 1000 ? '5%=' + Math.abs(currentValue * 0.05) : '2%=' + Math.abs(currentValue * 0.02)}W)`);
144
+ (0, logger_1.debug)("power", `[Binding ${idx}] NOT significant for channel ${b.channel} -> register ${b.register}: ${currentValue}W -> ${power}W (diff: ${Math.abs(currentValue - power)}W, threshold: ${Math.abs(currentValue) < 1000 ? '5%=' + Math.abs(currentValue * 0.05) : '2%=' + Math.abs(currentValue * 0.02)}W)`);
142
145
  }
143
146
  });
144
147
  }