Skip to content

Commit

Permalink
Minor bug fixes (#10)
Browse files Browse the repository at this point in the history
* Prep for next release

* GSH crashes when HB restarts

* Revert "GSH crashes when HB restarts"

This reverts commit ec1c9e8.

* GSH Crashes when another HB restarts

* Update CHANGELOG.md

* Update Hap-Client

* Test Issues

* Fix for instanceDenylist not working

* Update package.json
  • Loading branch information
NorthernMan54 authored Dec 18, 2024
1 parent 1dd00bf commit 16d5c28
Show file tree
Hide file tree
Showing 21 changed files with 91 additions and 33 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to `homebridge-gsh` will be documented in this file. This project tries to adhere to [Semantic Versioning](http://semver.org/).

## v3.1.1 (2024-12-05)

### Changes

### Fixes

- Fixed an issue where the plugin restarted when another child bridge restarted.
- Dependency Updates

## v3.1.0 (2024-11-11)

### Changes
Expand Down
4 changes: 2 additions & 2 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
{
"nodescription": true,
"notitle": true,
"key": "instanceBlacklist",
"key": "instanceDenylist",
"type": "array",
"items": [
{
Expand All @@ -124,7 +124,7 @@
"flex-direction": "row",
"items": [
{
"key": "instanceBlacklist[]",
"key": "instanceDenylist[]",
"flex": "1 1 50px",
"notitle": true,
"placeholder": "Enter homebridge username..."
Expand Down
54 changes: 35 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "homebridge-gsh",
"displayName": "Homebridge Google Smart Home",
"version": "3.1.0",
"version": "3.1.1",
"description": "Google Smart Home",
"homepage": "https://github.com/homebridge-plugins/homebridge-gsh/blob/latest/README.md",
"license": "GPL-3.0",
"author": "oznu <dev@oz.nu>",
"author": "NorthernMan54",
"repository": {
"url": "git+https://github.com/homebridge-plugins/homebridge-gsh.git"
},
Expand Down Expand Up @@ -50,7 +50,7 @@
"rxjs"
],
"dependencies": {
"@homebridge/hap-client": "^2.0.4",
"@homebridge/hap-client": "^2.0.5",
"@homebridge/ws-connect": "^3.0.0",
"chalk": "^5.3.0",
"fs-extra": "^11.2.0",
Expand Down
11 changes: 6 additions & 5 deletions src/hap.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { describe, it, expect } from '@jest/globals';
import { CharacteristicType, ServiceType } from '@homebridge/hap-client';
import { SmartHomeV1QueryRequestDevices, SmartHomeV1SyncDevices, SmartHomeV1ExecuteRequestCommands } from 'actions-on-google';
import { describe, expect } from '@jest/globals';
import { SmartHomeV1QueryRequestDevices, SmartHomeV1SyncDevices } from 'actions-on-google';
import { expectType } from 'ts-expect';
import { Hap } from './hap';
import { PluginConfig } from './interfaces';
import { Log } from './logger';
import fs from 'node:fs';
import { expectType } from 'ts-expect';
import exp from 'node:constants';

// socket, log, pin: string, config: PluginConfig

Expand Down Expand Up @@ -613,6 +611,7 @@ const hapServiceHue: ServiceType = {
port: 46283,
connectionFailedCount: 0,
services: [],
configurationNumber: 1,
},
uniqueId: '2a1f1a87419c2afbd847828b96095f892975c36572751ab71f53edf0c5372fdb',
refreshCharacteristics,
Expand Down Expand Up @@ -687,6 +686,7 @@ const hapServiceOnOff: ServiceType = {
port: 46283,
connectionFailedCount: 0,
services: [],
configurationNumber: 1,
},
uniqueId: '664195d5556f1e0b424ed32bcd863ec8954c76f8ab81cc399f0e24f8827806d1',
refreshCharacteristics,
Expand Down Expand Up @@ -782,6 +782,7 @@ const hapServiceDimmer: ServiceType = {
port: 46283,
connectionFailedCount: 0,
services: [],
configurationNumber: 1,
},
uniqueId: '028fc478c0b4b116ead9be0dc8a72251b351b745cbc3961704268737101c803d',
refreshCharacteristics,
Expand Down
6 changes: 3 additions & 3 deletions src/hap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { PluginConfig } from './interfaces';
import { Log } from './logger';
import { Door } from './types/door';

import { createHash } from 'node:crypto';
import { Fan } from './types/fan';
import { Fanv2 } from './types/fan-v2';
import { GarageDoorOpener } from './types/garage-door-opener';
Expand All @@ -22,7 +23,6 @@ import { TemperatureSensor } from './types/temperature-sensor';
import { Thermostat } from './types/thermostat';
import { Window } from './types/window';
import { WindowCovering } from './types/window-covering';
import { createHash } from 'node:crypto';

export class Hap {
socket;
Expand Down Expand Up @@ -101,7 +101,7 @@ export class Hap {
this.accessoryFilter = config.accessoryFilter || [];
this.accessoryFilterInverse = config.accessoryFilterInverse || false;
this.accessorySerialFilter = config.accessorySerialFilter || [];
this.instanceBlacklist = config.instanceBlacklist || [];
this.instanceBlacklist = config.instanceDenylist || [];

this.log.debug('Waiting 15 seconds before starting instance discovery...');
this.startTimeout = setTimeout(() => {
Expand Down Expand Up @@ -155,7 +155,7 @@ export class Hap {
this.hapClient.removeListener('instance-discovered', this.waitForNoMoreDiscoveries);
this.start();
this.requestSync();
this.hapClient.on('instance-discovered', this.requestSync); // Request sync on new instance discovery
this.hapClient.on('instance-discovered', this.requestSync.bind(this)); // Request sync on new instance discovery
}, 5000);
};

Expand Down
4 changes: 3 additions & 1 deletion src/types/door.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from '@jest/globals';
import { CharacteristicType, ServiceType } from '@homebridge/hap-client';
import { expect } from '@jest/globals';
import { Door } from './door';

const door = new Door();
Expand Down Expand Up @@ -301,6 +301,7 @@ const doorServiceOnOff: ServiceType = {
port: 46283,
connectionFailedCount: 0,
services: [],
configurationNumber: 1,
},
uniqueId: '664195d5556f1e0b424ed32bcd863ec8954c76f8ab81cc399f0e24f8827806d1',
refreshCharacteristics,
Expand Down Expand Up @@ -396,6 +397,7 @@ const doorServiceDimmer: ServiceType = {
port: 46283,
connectionFailedCount: 0,
services: [],
configurationNumber: 1,
},
uniqueId: '028fc478c0b4b116ead9be0dc8a72251b351b745cbc3961704268737101c803d',
refreshCharacteristics,
Expand Down
2 changes: 2 additions & 0 deletions src/types/fan-v2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ const fanServiceOnOff: ServiceType = {
port: 46283,
connectionFailedCount: 0,
services: [],
configurationNumber: 1,
},
uniqueId: '664195d5556f1e0b424ed32bcd863ec8954c76f8ab81cc399f0e24f8827806d1',
refreshCharacteristics,
Expand Down Expand Up @@ -349,6 +350,7 @@ const fanServiceDimmer: ServiceType = {
port: 46283,
connectionFailedCount: 0,
services: [],
configurationNumber: 1,
},
uniqueId: '028fc478c0b4b116ead9be0dc8a72251b351b745cbc3961704268737101c803d',
refreshCharacteristics,
Expand Down
3 changes: 3 additions & 0 deletions src/types/fan.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ const fanServiceHue: ServiceType = {
port: 46283,
connectionFailedCount: 0,
services: [],
configurationNumber: 1,
},
uniqueId: '2a1f1a87419c2afbd847828b96095f892975c36572751ab71f53edf0c5372fdb',
refreshCharacteristics,
Expand Down Expand Up @@ -419,6 +420,7 @@ const fanServiceOnOff: ServiceType = {
port: 46283,
connectionFailedCount: 0,
services: [],
configurationNumber: 1,
},
uniqueId: '664195d5556f1e0b424ed32bcd863ec8954c76f8ab81cc399f0e24f8827806d1',
refreshCharacteristics,
Expand Down Expand Up @@ -514,6 +516,7 @@ const fanServiceDimmer: ServiceType = {
port: 46283,
connectionFailedCount: 0,
services: [],
configurationNumber: 1,
},
uniqueId: '028fc478c0b4b116ead9be0dc8a72251b351b745cbc3961704268737101c803d',
refreshCharacteristics,
Expand Down
1 change: 1 addition & 0 deletions src/types/garage-door-opener.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ const garageDoorOpenerServiceOpenClose: ServiceType = {
port: 46283,
connectionFailedCount: 0,
services: [],
configurationNumber: 1,
},
uniqueId: '664195d5556f1e0b424ed32bcd863ec8954c76f8ab81cc399f0e24f8827806d1',
refreshCharacteristics,
Expand Down
Loading

0 comments on commit 16d5c28

Please sign in to comment.