homebridge-homeassistant-garagedoor 1.0.4 → 1.0.7
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/index.js +9 -3
- package/package.json +39 -8
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}]
|
|
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,18 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-homeassistant-garagedoor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Homebridge plugin to control Home Assistant switches as Garage Doors",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
8
|
},
|
|
9
9
|
"keywords": [
|
|
10
|
-
"homebridge-plugin"
|
|
11
|
-
"homebridge",
|
|
12
|
-
"homeassistant",
|
|
13
|
-
"garage",
|
|
14
|
-
"door",
|
|
15
|
-
"switch"
|
|
10
|
+
"homebridge-plugin"
|
|
16
11
|
],
|
|
17
12
|
"author": "torresyago",
|
|
18
13
|
"license": "MIT",
|
|
@@ -32,6 +27,42 @@
|
|
|
32
27
|
"axios": "^1.6.0"
|
|
33
28
|
},
|
|
34
29
|
"homebridge": {
|
|
35
|
-
"pluginAlias": "
|
|
30
|
+
"pluginAlias": "Home Assistant Garage Door",
|
|
31
|
+
"pluginConfigSchema": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"properties": {
|
|
34
|
+
"name": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"title": "Name",
|
|
37
|
+
"required": true,
|
|
38
|
+
"default": "Garage Door"
|
|
39
|
+
},
|
|
40
|
+
"haUrl": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"title": "Home Assistant URL",
|
|
43
|
+
"required": true,
|
|
44
|
+
"placeholder": "http://192.168.1.100:8123"
|
|
45
|
+
},
|
|
46
|
+
"haToken": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"title": "HA Long-Lived Access Token",
|
|
49
|
+
"required": true,
|
|
50
|
+
"placeholder": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
|
|
51
|
+
},
|
|
52
|
+
"entityId": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"title": "Entity ID",
|
|
55
|
+
"required": true,
|
|
56
|
+
"default": "switch.garage_door",
|
|
57
|
+
"placeholder": "switch.Puerta1"
|
|
58
|
+
},
|
|
59
|
+
"pollInterval": {
|
|
60
|
+
"type": "number",
|
|
61
|
+
"title": "Poll Interval (seconds)",
|
|
62
|
+
"required": false,
|
|
63
|
+
"default": 30
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
36
67
|
}
|
|
37
68
|
}
|