homebridge-homeassistant-garagedoor 1.0.4 → 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.
Files changed (2) hide show
  1. package/index.js +9 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  const axios = require('axios');
4
4
 
5
5
  class HomeAssistantGarageDoor {
6
- constructor(log, config) {
6
+ constructor(log, config, api) {
7
7
  this.log = log;
8
8
  this.name = config.name;
9
9
  this.haUrl = config.haUrl;
@@ -14,6 +14,10 @@ class HomeAssistantGarageDoor {
14
14
  this.targetState = 'CLOSED';
15
15
  this.polling = null;
16
16
 
17
+ // ✅ FIX: API params para Service/Characteristic
18
+ this.Service = api.hap.Service;
19
+ this.Characteristic = api.hap.Characteristic;
20
+
17
21
  this.log(`[${this.name}] Initializing HomeAssistantGarageDoor accessory...`);
18
22
 
19
23
  this.service = new this.Service.GarageDoorOpener(this.name);
@@ -23,12 +27,11 @@ class HomeAssistantGarageDoor {
23
27
  }
24
28
 
25
29
  initHA() {
26
- this.log(`[${this.name}] [${this.name}] Initialized - HA: ${this.haUrl} (${this.entityId})`);
30
+ this.log(`[${this.name}] Initialized - HA: ${this.haUrl} (${this.entityId})`);
27
31
  this.startPolling();
28
32
  }
29
33
 
30
34
  async sendHACommand(state) {
31
- // 🔧 FIX v1.0.3: Skip request si estado coincide
32
35
  if (this.currentState === state) {
33
36
  this.log(`[${this.name}] State matches target (${state}) → Skipping HA request`);
34
37
  return;
@@ -97,6 +100,9 @@ class HomeAssistantGarageDoor {
97
100
  callback();
98
101
  });
99
102
 
103
+ this.service.getCharacteristic(this.Characteristic.CurrentDoorState)
104
+ .updateValue(this.Characteristic.CurrentDoorState.CLOSED);
105
+
100
106
  return [this.service];
101
107
  }
102
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-homeassistant-garagedoor",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Homebridge plugin to control Home Assistant switches as Garage Doors",
5
5
  "main": "index.js",
6
6
  "scripts": {