homebridge-homeassistant-things 2.1.1 → 2.2.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.
@@ -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
- - run: npm publish --provenance --access public
18
+ registry-url: 'https://registry.npmjs.org/'
19
+ - run: npm publish --access public
20
20
  env:
21
- NPM_CONFIG_REGISTRY: https://registry.npmjs.org/
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.2.0] - 2026-04-02
14
+
15
+ ### Added / Añadido
16
+ - **EN** New `deviceType: "pulse"` — momentary switch: sends `turn_on` to HA then auto `turn_off` after `pulseTime` ms. Useful for doorbells, relay pulses, etc.
17
+ - **EN** New `deviceType: "button"` — stateless programmable switch: triggers HomeKit automations on press. No HA state sync needed.
18
+ - **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.
19
+ - **ES** Nuevo `deviceType: "button"` — botón sin estado: dispara automatizaciones HomeKit al pulsar. Sin sincronización de estado con HA.
20
+
21
+ ---
22
+
23
+ ## [2.1.3] - 2026-04-02
24
+
25
+ ### Changed / Cambios
26
+ - **EN** Updated publish workflow to use npm token — author now shows correctly as @yagotorres in Homebridge plugin catalogue.
27
+ - **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.
28
+
29
+ ---
30
+
31
+ ## [2.1.2] - 2026-04-02
32
+
33
+ ### Changed / Cambios
34
+ - **EN** README: added troubleshooting section for users upgrading from v1.x — explains how to uninstall, clear cache, restart and reinstall to fix schema caching issues.
35
+ - **ES** README: añadida sección de solución de problemas para usuarios que actualizan desde v1.x — explica cómo desinstalar, limpiar caché, reiniciar y reinstalar para resolver problemas de caché del schema.
36
+
37
+ ---
38
+
13
39
  ## [2.1.1] - 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",
@@ -325,6 +363,38 @@ La programación horaria no es una función del accesorio HomeKit — debe confi
325
363
 
326
364
  ---
327
365
 
366
+ ## Troubleshooting — after upgrading to v2.0.0 or later
367
+
368
+ From v2.0.0 this plugin changed from `accessory` to `platform`. If Config UI X still generates `"accessory"` instead of `"platform"` after updating, follow these steps:
369
+
370
+ 1. **Uninstall the plugin** from Config UI X → Plugins → `homebridge-homeassistant-things` → Uninstall
371
+ 2. **Clear the Homebridge accessory cache**: Config UI X → Settings → scroll down → **Remove All Cached Accessories**
372
+ 3. **Restart the Homebridge container/service** completely:
373
+ - Docker: `docker restart homebridge`
374
+ - systemd: `sudo systemctl restart homebridge`
375
+ 4. **Reinstall the plugin** from Config UI X → search `homebridge-homeassistant-things` → Install
376
+ 5. **Add the plugin again** from the Config UI X assistant — it will now generate the correct `"platform"` config
377
+
378
+ > This is necessary because Config UI X caches the plugin schema. A full restart forces it to reload the schema from the newly installed version.
379
+
380
+ ---
381
+
382
+ ## Solución de problemas — tras actualizar a v2.0.0 o superior
383
+
384
+ Desde v2.0.0 este plugin cambió de `accessory` a `platform`. Si Config UI X sigue generando `"accessory"` en lugar de `"platform"` tras actualizar, sigue estos pasos:
385
+
386
+ 1. **Desinstala el plugin** desde Config UI X → Plugins → `homebridge-homeassistant-things` → Desinstalar
387
+ 2. **Limpia la caché de accesorios**: Config UI X → Ajustes → baja hasta **Eliminar todos los accesorios en caché**
388
+ 3. **Reinicia completamente el contenedor/servicio de Homebridge**:
389
+ - Docker: `docker restart homebridge`
390
+ - systemd: `sudo systemctl restart homebridge`
391
+ 4. **Vuelve a instalar el plugin** desde Config UI X → busca `homebridge-homeassistant-things` → Instalar
392
+ 5. **Añade el plugin de nuevo** desde el asistente de Config UI X — ahora generará la config correcta con `"platform"`
393
+
394
+ > Esto es necesario porque Config UI X cachea el schema del plugin. Un reinicio completo fuerza la recarga del schema desde la versión recién instalada.
395
+
396
+ ---
397
+
328
398
  ## Changelog
329
399
 
330
400
  See [CHANGELOG.md](CHANGELOG.md) for version history.
@@ -33,7 +33,9 @@
33
33
  { "title": "Thermostat (climate entity)", "enum": ["thermostat"] },
34
34
  { "title": "Blind / Shutter (cover entity)", "enum": ["blind"] },
35
35
  { "title": "Garage Door (pulse relay)", "enum": ["garageDoor"] },
36
- { "title": "Sensor (read-only numeric, e.g. power/energy)", "enum": ["sensor"] }
36
+ { "title": "Sensor (read-only numeric, e.g. power/energy)", "enum": ["sensor"] },
37
+ { "title": "Pulse (momentary switch — auto turn_off after pulseTime)", "enum": ["pulse"] },
38
+ { "title": "Button (stateless — triggers HomeKit automations)", "enum": ["button"] }
37
39
  ]
38
40
  },
39
41
  "haUrl": {
package/index.js CHANGED
@@ -114,6 +114,8 @@ class ThingHandler {
114
114
  case 'blind': this._setupBlind(); break;
115
115
  case 'garageDoor': this._setupGarageDoor(); break;
116
116
  case 'sensor': this._setupSensor(); break;
117
+ case 'pulse': this._setupPulse(); break;
118
+ case 'button': this._setupButton(); break;
117
119
  default: this._setupSwitch();
118
120
  }
119
121
  }
@@ -279,6 +281,41 @@ class ThingHandler {
279
281
  }
280
282
  }
281
283
 
284
+ // ─── PULSE (momentary switch — turn_on then auto turn_off) ──────────────
285
+
286
+ _setupPulse() {
287
+ const { Service, Characteristic } = this.hap;
288
+ this.state.on = false;
289
+
290
+ this.service = this.accessory.getService(Service.Switch)
291
+ || this.accessory.addService(Service.Switch, this.name);
292
+
293
+ this.service.getCharacteristic(Characteristic.On)
294
+ .onGet(() => false)
295
+ .onSet((value) => {
296
+ if (!value) return;
297
+ this.log.info(`[${this.name}] Pulse: turn_on → wait ${this.pulseTime}ms → turn_off`);
298
+ this._sendCommand('switch', 'turn_on', {});
299
+ setTimeout(() => {
300
+ this._sendCommand('switch', 'turn_off', {});
301
+ this.service.updateCharacteristic(Characteristic.On, false);
302
+ }, this.pulseTime);
303
+ });
304
+ }
305
+
306
+ // ─── BUTTON (stateless programmable switch — triggers HomeKit automations) ─
307
+
308
+ _setupButton() {
309
+ const { Service, Characteristic } = this.hap;
310
+
311
+ this.service = this.accessory.getService(Service.StatelessProgrammableSwitch)
312
+ || this.accessory.addService(Service.StatelessProgrammableSwitch, this.name);
313
+
314
+ // Only expose single press
315
+ this.service.getCharacteristic(Characteristic.ProgrammableSwitchEvent)
316
+ .setProps({ validValues: [Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS] });
317
+ }
318
+
282
319
  // ─── SENSOR (read-only numeric, e.g. power/energy) ───────────────────────
283
320
 
284
321
  _setupSensor() {
@@ -296,6 +333,8 @@ class ThingHandler {
296
333
 
297
334
  async _pollHA() {
298
335
  if (this.deviceType === 'garageDoor') return;
336
+ if (this.deviceType === 'pulse') return;
337
+ if (this.deviceType === 'button') return;
299
338
  if (this.deviceType === 'sensor') { await this._pollSensor(); return; }
300
339
 
301
340
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-homeassistant-things",
3
- "version": "2.1.1",
3
+ "version": "2.2.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": [