@rfranzoi/scrypted-mqtt-securitysystem 1.0.55 → 1.0.56

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.
@@ -34180,14 +34180,17 @@ class BaseMqttSensor extends sdk_1.ScryptedDeviceBase {
34180
34180
  np === 'battery_low' ||
34181
34181
  truthy(np);
34182
34182
  this.lowBattery = isLow;
34183
- try {
34184
- this.onDeviceEvent(sdk_1.ScryptedInterface.Battery, isLow);
34185
- }
34186
- catch (e) {
34187
- this.console?.warn?.('Battery low event error', e);
34188
- }
34183
+ // Simula anche la percentuale per HomeKit/Scrypted:
34184
+ // low -> 10%
34185
+ // ok -> 100%
34186
+ const level = isLow ? 10 : 100;
34187
+ this.setAndEmit('batteryLevel', level, sdk_1.ScryptedInterface.Battery, {
34188
+ topic,
34189
+ raw,
34190
+ propLabel: 'batteryLevel(from lowBattery)',
34191
+ });
34189
34192
  if (RUNTIME.logSensors) {
34190
- this.console?.log?.(`[Sensor] ${this.cfg.name} [${this.cfg.id}] lowBattery -> ${isLow} (${topic}="${raw}")`);
34193
+ this.console?.log?.(`[Sensor] ${this.cfg.name} [${this.cfg.id}] lowBattery -> ${isLow}, level -> ${level} (${topic}="${raw}")`);
34191
34194
  }
34192
34195
  return;
34193
34196
  }
package/dist/plugin.zip CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rfranzoi/scrypted-mqtt-securitysystem",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "description": "Scrypted plugin: Paradox Security System via MQTT (PAI/PAI-MQTT style).",
5
5
  "license": "MIT",
6
6
  "main": "dist/main.nodejs.js",