homebridge-homeassistant-things 2.1.2 → 2.3.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/.github/workflows/publish.yml +3 -3
- package/CHANGELOG.md +26 -0
- package/README.md +38 -0
- package/config.schema.json +15 -2
- package/index.js +50 -0
- package/package.json +1 -1
|
@@ -9,13 +9,13 @@ jobs:
|
|
|
9
9
|
publish:
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
11
|
permissions:
|
|
12
|
-
id-token: write
|
|
13
12
|
contents: read
|
|
14
13
|
steps:
|
|
15
14
|
- uses: actions/checkout@v4
|
|
16
15
|
- uses: actions/setup-node@v4
|
|
17
16
|
with:
|
|
18
17
|
node-version: '24'
|
|
19
|
-
|
|
18
|
+
registry-url: 'https://registry.npmjs.org/'
|
|
19
|
+
- run: npm publish --access public
|
|
20
20
|
env:
|
|
21
|
-
|
|
21
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,32 @@ Todos los cambios relevantes de este proyecto se documentan aquí.
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
+
## [2.3.0] - 2026-04-02
|
|
14
|
+
|
|
15
|
+
### Added / Añadido
|
|
16
|
+
- **EN** Platform-level `haUrl` and `haToken` defaults — set them once at platform level and all devices inherit them. Individual devices can still override with their own values.
|
|
17
|
+
- **ES** Valores por defecto de `haUrl` y `haToken` a nivel de plataforma — se configuran una vez y todos los dispositivos los heredan. Cada dispositivo puede sobrescribirlos con sus propios valores si es necesario.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## [2.2.0] - 2026-04-02
|
|
22
|
+
|
|
23
|
+
### Added / Añadido
|
|
24
|
+
- **EN** New `deviceType: "pulse"` — momentary switch: sends `turn_on` to HA then auto `turn_off` after `pulseTime` ms. Useful for doorbells, relay pulses, etc.
|
|
25
|
+
- **EN** New `deviceType: "button"` — stateless programmable switch: triggers HomeKit automations on press. No HA state sync needed.
|
|
26
|
+
- **ES** Nuevo `deviceType: "pulse"` — pulsador momentáneo: envía `turn_on` a HA y luego `turn_off` automáticamente tras `pulseTime` ms. Útil para timbres, relés de pulso, etc.
|
|
27
|
+
- **ES** Nuevo `deviceType: "button"` — botón sin estado: dispara automatizaciones HomeKit al pulsar. Sin sincronización de estado con HA.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## [2.1.3] - 2026-04-02
|
|
32
|
+
|
|
33
|
+
### Changed / Cambios
|
|
34
|
+
- **EN** Updated publish workflow to use npm token — author now shows correctly as @yagotorres in Homebridge plugin catalogue.
|
|
35
|
+
- **ES** Actualizado el workflow de publicación para usar token npm — el autor ahora aparece correctamente como @yagotorres en el catálogo de plugins de Homebridge.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
13
39
|
## [2.1.2] - 2026-04-02
|
|
14
40
|
|
|
15
41
|
### Changed / Cambios
|
package/README.md
CHANGED
|
@@ -83,6 +83,8 @@ Desde v2.0.0 el plugin es una **dynamic platform**. Mueve la config del bloque `
|
|
|
83
83
|
| `blind` | Window Covering | `cover` | Bidirectional |
|
|
84
84
|
| `garageDoor` | Garage Door Opener | `switch` (pulse relay) | One-way |
|
|
85
85
|
| `sensor` | Light Sensor | `sensor` (any numeric) | Read-only |
|
|
86
|
+
| `pulse` | Switch (momentary) | `switch` (pulse relay) | One-way |
|
|
87
|
+
| `button` | Stateless Switch | any (no state needed) | One-way |
|
|
86
88
|
|
|
87
89
|
### Features
|
|
88
90
|
|
|
@@ -92,6 +94,8 @@ Desde v2.0.0 el plugin es una **dynamic platform**. Mueve la config del bloque `
|
|
|
92
94
|
- Blind: open/close/stop, position 0–100%, moving state
|
|
93
95
|
- Garage door: pulse relay logic (turn_on → 2s → turn_off)
|
|
94
96
|
- Sensor: read-only numeric values (power, energy, temperature, etc.) — usable in HomeKit automations
|
|
97
|
+
- Pulse: momentary switch — sends `turn_on` then auto `turn_off` after `pulseTime` ms. Useful for doorbells, relay pulses, etc.
|
|
98
|
+
- Button: stateless programmable switch — triggers HomeKit automations on press. No state, no HA entity needed.
|
|
95
99
|
- Config UI X form — no manual JSON editing required
|
|
96
100
|
|
|
97
101
|
### Installation
|
|
@@ -156,6 +160,21 @@ Full example with all device types:
|
|
|
156
160
|
"closingTime": 15,
|
|
157
161
|
"pulseTime": 2000
|
|
158
162
|
},
|
|
163
|
+
{
|
|
164
|
+
"name": "Doorbell Relay",
|
|
165
|
+
"deviceType": "pulse",
|
|
166
|
+
"haUrl": "http://homeassistant.local:8123",
|
|
167
|
+
"haToken": "eyJhbGciOiJIUzI1NiIs...",
|
|
168
|
+
"entityId": "switch.doorbell_relay",
|
|
169
|
+
"pulseTime": 500
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "Scene Button",
|
|
173
|
+
"deviceType": "button",
|
|
174
|
+
"haUrl": "http://homeassistant.local:8123",
|
|
175
|
+
"haToken": "eyJhbGciOiJIUzI1NiIs...",
|
|
176
|
+
"entityId": "input_boolean.dummy"
|
|
177
|
+
},
|
|
159
178
|
{
|
|
160
179
|
"name": "Power Consumption",
|
|
161
180
|
"deviceType": "sensor",
|
|
@@ -213,6 +232,8 @@ Scheduling is not a HomeKit accessory feature — it must be configured through
|
|
|
213
232
|
| `blind` | Persiana | `cover` | Bidireccional |
|
|
214
233
|
| `garageDoor` | Puerta de Garaje | `switch` (relé pulso) | Unidireccional |
|
|
215
234
|
| `sensor` | Sensor de Luz | `sensor` (cualquier numérico) | Solo lectura |
|
|
235
|
+
| `pulse` | Interruptor (momentáneo) | `switch` (relé de pulso) | Unidireccional |
|
|
236
|
+
| `button` | Interruptor sin estado | cualquiera (sin estado) | Unidireccional |
|
|
216
237
|
|
|
217
238
|
### Características
|
|
218
239
|
|
|
@@ -222,6 +243,8 @@ Scheduling is not a HomeKit accessory feature — it must be configured through
|
|
|
222
243
|
- Persiana: abrir/cerrar/parar, posición 0–100%, estado de movimiento
|
|
223
244
|
- Puerta de garaje: lógica de relé de pulso (turn_on → 2s → turn_off)
|
|
224
245
|
- Sensor: valores numéricos de solo lectura (potencia, energía, temperatura, etc.) — utilizables en automatizaciones HomeKit
|
|
246
|
+
- Pulsador (`pulse`): interruptor momentáneo — envía `turn_on` y luego `turn_off` automáticamente tras `pulseTime` ms. Útil para timbres, relés de pulso, etc.
|
|
247
|
+
- Botón (`button`): interruptor sin estado — dispara automatizaciones HomeKit al pulsar. Sin estado, sin necesidad de entidad HA.
|
|
225
248
|
- Formulario automático en Config UI X
|
|
226
249
|
|
|
227
250
|
### Instalación
|
|
@@ -286,6 +309,21 @@ Ejemplo completo con todos los tipos de dispositivo:
|
|
|
286
309
|
"closingTime": 15,
|
|
287
310
|
"pulseTime": 2000
|
|
288
311
|
},
|
|
312
|
+
{
|
|
313
|
+
"name": "Timbre",
|
|
314
|
+
"deviceType": "pulse",
|
|
315
|
+
"haUrl": "http://homeassistant.local:8123",
|
|
316
|
+
"haToken": "eyJhbGciOiJIUzI1NiIs...",
|
|
317
|
+
"entityId": "switch.rele_timbre",
|
|
318
|
+
"pulseTime": 500
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"name": "Botón Escena",
|
|
322
|
+
"deviceType": "button",
|
|
323
|
+
"haUrl": "http://homeassistant.local:8123",
|
|
324
|
+
"haToken": "eyJhbGciOiJIUzI1NiIs...",
|
|
325
|
+
"entityId": "input_boolean.dummy"
|
|
326
|
+
},
|
|
289
327
|
{
|
|
290
328
|
"name": "Consumo eléctrico",
|
|
291
329
|
"deviceType": "sensor",
|
package/config.schema.json
CHANGED
|
@@ -10,13 +10,24 @@
|
|
|
10
10
|
"type": "string",
|
|
11
11
|
"default": "HA Things"
|
|
12
12
|
},
|
|
13
|
+
"haUrl": {
|
|
14
|
+
"title": "Default Home Assistant URL",
|
|
15
|
+
"type": "string",
|
|
16
|
+
"placeholder": "http://homeassistant.local:8123",
|
|
17
|
+
"description": "Default HA URL for all devices. Can be overridden per device."
|
|
18
|
+
},
|
|
19
|
+
"haToken": {
|
|
20
|
+
"title": "Default Long-Lived Access Token",
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "Default HA token for all devices. Can be overridden per device."
|
|
23
|
+
},
|
|
13
24
|
"devices": {
|
|
14
25
|
"title": "Devices",
|
|
15
26
|
"type": "array",
|
|
16
27
|
"items": {
|
|
17
28
|
"title": "Device",
|
|
18
29
|
"type": "object",
|
|
19
|
-
"required": ["name", "deviceType", "
|
|
30
|
+
"required": ["name", "deviceType", "entityId"],
|
|
20
31
|
"properties": {
|
|
21
32
|
"name": {
|
|
22
33
|
"title": "Name",
|
|
@@ -33,7 +44,9 @@
|
|
|
33
44
|
{ "title": "Thermostat (climate entity)", "enum": ["thermostat"] },
|
|
34
45
|
{ "title": "Blind / Shutter (cover entity)", "enum": ["blind"] },
|
|
35
46
|
{ "title": "Garage Door (pulse relay)", "enum": ["garageDoor"] },
|
|
36
|
-
{ "title": "Sensor (read-only numeric, e.g. power/energy)", "enum": ["sensor"] }
|
|
47
|
+
{ "title": "Sensor (read-only numeric, e.g. power/energy)", "enum": ["sensor"] },
|
|
48
|
+
{ "title": "Pulse (momentary switch — auto turn_off after pulseTime)", "enum": ["pulse"] },
|
|
49
|
+
{ "title": "Button (stateless — triggers HomeKit automations)", "enum": ["button"] }
|
|
37
50
|
]
|
|
38
51
|
},
|
|
39
52
|
"haUrl": {
|
package/index.js
CHANGED
|
@@ -44,6 +44,17 @@ class HomeAssistantThingsPlatform {
|
|
|
44
44
|
}];
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
// Apply platform-level defaults for haUrl and haToken
|
|
48
|
+
const defaultHaUrl = this.config.haUrl;
|
|
49
|
+
const defaultHaToken = this.config.haToken;
|
|
50
|
+
if (defaultHaUrl || defaultHaToken) {
|
|
51
|
+
devices = devices.map(d => ({
|
|
52
|
+
haUrl: defaultHaUrl,
|
|
53
|
+
haToken: defaultHaToken,
|
|
54
|
+
...d,
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
|
|
47
58
|
const configuredUUIDs = new Set();
|
|
48
59
|
|
|
49
60
|
for (const deviceConfig of devices) {
|
|
@@ -114,6 +125,8 @@ class ThingHandler {
|
|
|
114
125
|
case 'blind': this._setupBlind(); break;
|
|
115
126
|
case 'garageDoor': this._setupGarageDoor(); break;
|
|
116
127
|
case 'sensor': this._setupSensor(); break;
|
|
128
|
+
case 'pulse': this._setupPulse(); break;
|
|
129
|
+
case 'button': this._setupButton(); break;
|
|
117
130
|
default: this._setupSwitch();
|
|
118
131
|
}
|
|
119
132
|
}
|
|
@@ -279,6 +292,41 @@ class ThingHandler {
|
|
|
279
292
|
}
|
|
280
293
|
}
|
|
281
294
|
|
|
295
|
+
// ─── PULSE (momentary switch — turn_on then auto turn_off) ──────────────
|
|
296
|
+
|
|
297
|
+
_setupPulse() {
|
|
298
|
+
const { Service, Characteristic } = this.hap;
|
|
299
|
+
this.state.on = false;
|
|
300
|
+
|
|
301
|
+
this.service = this.accessory.getService(Service.Switch)
|
|
302
|
+
|| this.accessory.addService(Service.Switch, this.name);
|
|
303
|
+
|
|
304
|
+
this.service.getCharacteristic(Characteristic.On)
|
|
305
|
+
.onGet(() => false)
|
|
306
|
+
.onSet((value) => {
|
|
307
|
+
if (!value) return;
|
|
308
|
+
this.log.info(`[${this.name}] Pulse: turn_on → wait ${this.pulseTime}ms → turn_off`);
|
|
309
|
+
this._sendCommand('switch', 'turn_on', {});
|
|
310
|
+
setTimeout(() => {
|
|
311
|
+
this._sendCommand('switch', 'turn_off', {});
|
|
312
|
+
this.service.updateCharacteristic(Characteristic.On, false);
|
|
313
|
+
}, this.pulseTime);
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// ─── BUTTON (stateless programmable switch — triggers HomeKit automations) ─
|
|
318
|
+
|
|
319
|
+
_setupButton() {
|
|
320
|
+
const { Service, Characteristic } = this.hap;
|
|
321
|
+
|
|
322
|
+
this.service = this.accessory.getService(Service.StatelessProgrammableSwitch)
|
|
323
|
+
|| this.accessory.addService(Service.StatelessProgrammableSwitch, this.name);
|
|
324
|
+
|
|
325
|
+
// Only expose single press
|
|
326
|
+
this.service.getCharacteristic(Characteristic.ProgrammableSwitchEvent)
|
|
327
|
+
.setProps({ validValues: [Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS] });
|
|
328
|
+
}
|
|
329
|
+
|
|
282
330
|
// ─── SENSOR (read-only numeric, e.g. power/energy) ───────────────────────
|
|
283
331
|
|
|
284
332
|
_setupSensor() {
|
|
@@ -296,6 +344,8 @@ class ThingHandler {
|
|
|
296
344
|
|
|
297
345
|
async _pollHA() {
|
|
298
346
|
if (this.deviceType === 'garageDoor') return;
|
|
347
|
+
if (this.deviceType === 'pulse') return;
|
|
348
|
+
if (this.deviceType === 'button') return;
|
|
299
349
|
if (this.deviceType === 'sensor') { await this._pollSensor(); return; }
|
|
300
350
|
|
|
301
351
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-homeassistant-things",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Homebridge plugin to control Home Assistant devices (switches, thermostats, blinds, garage doors) as native HomeKit accessories",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"keywords": [
|