@homebridge-plugins/homebridge-august 3.1.2 → 3.1.4
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/scripts/normalize-changelog-header.cjs +86 -0
- package/CHANGELOG.md +7 -2
- package/dist/connectivity-manager.d.ts +89 -0
- package/dist/connectivity-manager.d.ts.map +1 -0
- package/dist/connectivity-manager.js +264 -0
- package/dist/connectivity-manager.js.map +1 -0
- package/dist/devices/device.d.ts +0 -9
- package/dist/devices/device.d.ts.map +1 -1
- package/dist/devices/device.js +0 -32
- package/dist/devices/device.js.map +1 -1
- package/dist/devices/lock.d.ts +20 -1
- package/dist/devices/lock.d.ts.map +1 -1
- package/dist/devices/lock.js +133 -103
- package/dist/devices/lock.js.map +1 -1
- package/dist/package.json +9 -9
- package/dist/platform.d.ts +26 -19
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +101 -52
- package/dist/platform.js.map +1 -1
- package/dist/platform.matter.d.ts +6 -9
- package/dist/platform.matter.d.ts.map +1 -1
- package/dist/platform.matter.js +25 -31
- package/dist/platform.matter.js.map +1 -1
- package/docs/variables/default.html +1 -1
- package/package.json +9 -9
- package/test/connectivity-manager.test.ts +380 -0
- package/test/platform.matter.test.ts +660 -0
- package/test/platform.polling.test.ts +313 -0
- package/test/platform.test.ts +642 -0
- package/test/settings.test.ts +148 -0
- package/vitest.config.ts +2 -1
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { AugustPlatformConfig, credentials, device, options } from '../src/settings.js'
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from 'vitest'
|
|
4
|
+
|
|
5
|
+
import { PLATFORM_NAME, PLUGIN_NAME } from '../src/settings.js'
|
|
6
|
+
|
|
7
|
+
describe('settings', () => {
|
|
8
|
+
it('should have correct PLATFORM_NAME', () => {
|
|
9
|
+
expect(PLATFORM_NAME).toBe('August')
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it('should have correct PLUGIN_NAME', () => {
|
|
13
|
+
expect(PLUGIN_NAME).toBe('homebridge-august')
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('should define AugustPlatformConfig interface', () => {
|
|
17
|
+
const config: AugustPlatformConfig = {
|
|
18
|
+
platform: 'August',
|
|
19
|
+
credentials: {
|
|
20
|
+
apiKey: 'test-api-key',
|
|
21
|
+
pnSubKey: 'test-pn-sub-key',
|
|
22
|
+
installId: 'test-install-id',
|
|
23
|
+
augustId: 'test-august-id',
|
|
24
|
+
password: 'test-password',
|
|
25
|
+
countryCode: 'test-country-code',
|
|
26
|
+
},
|
|
27
|
+
options: {
|
|
28
|
+
devices: [],
|
|
29
|
+
allowInvalidCharacters: true,
|
|
30
|
+
refreshRate: 60,
|
|
31
|
+
updateRate: 60,
|
|
32
|
+
pushRate: 60,
|
|
33
|
+
logging: 'debug',
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
expect(config.credentials?.apiKey).toBe('test-api-key')
|
|
37
|
+
expect(config.options?.refreshRate).toBe(60)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('should define credentials interface', () => {
|
|
41
|
+
const creds: credentials = {
|
|
42
|
+
apiKey: 'test-api-key',
|
|
43
|
+
pnSubKey: 'test-pn-sub-key',
|
|
44
|
+
installId: 'test-install-id',
|
|
45
|
+
augustId: 'test-august-id',
|
|
46
|
+
password: 'test-password',
|
|
47
|
+
countryCode: 'test-country-code',
|
|
48
|
+
}
|
|
49
|
+
expect(creds.apiKey).toBe('test-api-key')
|
|
50
|
+
expect(creds.installId).toBe('test-install-id')
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('should define options interface', () => {
|
|
54
|
+
const opts: options = {
|
|
55
|
+
devices: [],
|
|
56
|
+
excludeLockIds: ['LOCK-ID-TO-EXCLUDE'],
|
|
57
|
+
allowInvalidCharacters: true,
|
|
58
|
+
refreshRate: 60,
|
|
59
|
+
updateRate: 60,
|
|
60
|
+
pushRate: 60,
|
|
61
|
+
logging: 'debug',
|
|
62
|
+
}
|
|
63
|
+
expect(opts.refreshRate).toBe(60)
|
|
64
|
+
expect(opts.logging).toBe('debug')
|
|
65
|
+
expect(opts.excludeLockIds).toContain('LOCK-ID-TO-EXCLUDE')
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it('should support disableMatter option', () => {
|
|
69
|
+
const opts: options = {
|
|
70
|
+
devices: [],
|
|
71
|
+
disableMatter: true,
|
|
72
|
+
}
|
|
73
|
+
expect(opts.disableMatter).toBe(true)
|
|
74
|
+
|
|
75
|
+
const optsDefault: options = {
|
|
76
|
+
devices: [],
|
|
77
|
+
}
|
|
78
|
+
expect(optsDefault.disableMatter).toBeUndefined()
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it('should define device interface', () => {
|
|
82
|
+
const dev: device = {
|
|
83
|
+
LockName: 'Test Lock',
|
|
84
|
+
Type: 1,
|
|
85
|
+
Created: '2023-01-01',
|
|
86
|
+
Updated: '2023-01-02',
|
|
87
|
+
LockId: 'test-lock-id',
|
|
88
|
+
HouseID: 'test-house-id',
|
|
89
|
+
HouseName: 'Test House',
|
|
90
|
+
Calibrated: true,
|
|
91
|
+
timeZone: 'UTC',
|
|
92
|
+
battery: 100,
|
|
93
|
+
batteryInfo: {
|
|
94
|
+
level: 100,
|
|
95
|
+
warningState: 'none',
|
|
96
|
+
infoUpdatedDate: '2023-01-01',
|
|
97
|
+
lastChangeDate: '2023-01-01',
|
|
98
|
+
lastChangeVoltage: 4.2,
|
|
99
|
+
},
|
|
100
|
+
doorStateOpenTimeout: 30,
|
|
101
|
+
hostLockInfo: {
|
|
102
|
+
serialNumber: 'test-serial-number',
|
|
103
|
+
manufacturer: 'Test Manufacturer',
|
|
104
|
+
productID: 1234,
|
|
105
|
+
productTypeID: 5678,
|
|
106
|
+
},
|
|
107
|
+
supportsEntryCodes: true,
|
|
108
|
+
remoteOperateSecret: 'test-secret',
|
|
109
|
+
skuNumber: 'test-sku',
|
|
110
|
+
macAddress: '00:11:22:33:44:55',
|
|
111
|
+
SerialNumber: 'test-serial-number',
|
|
112
|
+
LockStatus: {
|
|
113
|
+
status: 'locked',
|
|
114
|
+
dateTime: '2023-01-01T00:00:00Z',
|
|
115
|
+
isLockStatusChanged: true,
|
|
116
|
+
valid: true,
|
|
117
|
+
doorState: 'closed',
|
|
118
|
+
},
|
|
119
|
+
currentFirmwareVersion: '1.0.0',
|
|
120
|
+
homeKitEnabled: true,
|
|
121
|
+
zWaveEnabled: true,
|
|
122
|
+
isGalileo: false,
|
|
123
|
+
Bridge: {
|
|
124
|
+
_id: 'test-bridge-id',
|
|
125
|
+
mfgBridgeID: 'test-mfg-bridge-id',
|
|
126
|
+
deviceModel: 'test-model',
|
|
127
|
+
firmwareVersion: '1.0.0',
|
|
128
|
+
operative: true,
|
|
129
|
+
status: {
|
|
130
|
+
current: 'online',
|
|
131
|
+
lastOffline: '2023-01-01T00:00:00Z',
|
|
132
|
+
updated: '2023-01-01T00:00:00Z',
|
|
133
|
+
lastOnline: '2023-01-01T00:00:00Z',
|
|
134
|
+
},
|
|
135
|
+
locks: [],
|
|
136
|
+
hyperBridge: false,
|
|
137
|
+
},
|
|
138
|
+
parametersToSet: {},
|
|
139
|
+
users: {},
|
|
140
|
+
pubsubChannel: 'test-channel',
|
|
141
|
+
ruleHash: {},
|
|
142
|
+
cameras: [],
|
|
143
|
+
lockId: 'test-lock-id',
|
|
144
|
+
}
|
|
145
|
+
expect(dev.LockName).toBe('Test Lock')
|
|
146
|
+
expect(dev.battery).toBe(100)
|
|
147
|
+
})
|
|
148
|
+
})
|