Skip to content

Commit 6724506

Browse files
authored
Fix August lock not appearing in HomeKit due to invisible error messages (#179)
1 parent b336918 commit 6724506

File tree

3 files changed

+102
-3
lines changed

3 files changed

+102
-3
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,31 @@ plugin allows you to access your <a href="https://august.com">August</a> & <a hr
4040
- Yale Assure Lock 2 (YDR410)
4141
- Yale Assure Lock SL (YDR256)
4242

43+
## Troubleshooting
44+
45+
### Lock is detected but doesn't appear in HomeKit
46+
47+
If you see "Total August Locks Found: 1" in the logs but your lock doesn't appear in HomeKit, it's likely because your August lock already has HomeKit enabled. Pro models often have this enabled by default.
48+
49+
**Solution:** Add the following to your device configuration:
50+
```json
51+
{
52+
"name": "August",
53+
"platform": "August",
54+
"credentials": { ... },
55+
"options": {
56+
"devices": [
57+
{
58+
"lockId": "YOUR_LOCK_ID",
59+
"overrideHomeKitEnabled": true
60+
}
61+
]
62+
}
63+
}
64+
```
65+
66+
You can find your lock ID in the Homebridge logs.
67+
4368
## Thanks
4469

4570
Thank you to [hufftheweevil](https://github.com/hufftheweevil) for the [august-api](https://github.com/hufftheweevil/august-api) module.

src/platform.test.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,4 +498,78 @@ describe('AugustPlatform', () => {
498498
expect(savedConfig.platforms[0].credentials.installId).toBeDefined()
499499
})
500500
})
501+
502+
describe('registerDevice', () => {
503+
it('should register device when hide_device is false and homeKitEnabled is false', async () => {
504+
platform = new AugustPlatform(mockLog, mockConfig, mockApi)
505+
506+
const mockDevice = {
507+
LockName: 'Test Lock',
508+
lockId: 'test-lock-id',
509+
hide_device: false,
510+
homeKitEnabled: false,
511+
overrideHomeKitEnabled: false,
512+
} as any
513+
514+
const result = await platform.registerDevice(mockDevice)
515+
516+
expect(result).toBe(true)
517+
expect(mockLog.info).toHaveBeenCalledWith('[DEBUG]', 'Device: Test Lock Enabled')
518+
})
519+
520+
it('should register device when homeKitEnabled is true and overrideHomeKitEnabled is true', async () => {
521+
platform = new AugustPlatform(mockLog, mockConfig, mockApi)
522+
523+
const mockDevice = {
524+
LockName: 'Test Lock',
525+
lockId: 'test-lock-id',
526+
hide_device: false,
527+
homeKitEnabled: true,
528+
overrideHomeKitEnabled: true,
529+
} as any
530+
531+
const result = await platform.registerDevice(mockDevice)
532+
533+
expect(result).toBe(true)
534+
expect(mockLog.warn).toHaveBeenCalledWith(
535+
'[DEBUG]', 'Device: Test Lock HomeKit Enabled: true, Override HomeKit Enabled: true'
536+
)
537+
})
538+
539+
it('should NOT register device when homeKitEnabled is true and overrideHomeKitEnabled is false', async () => {
540+
platform = new AugustPlatform(mockLog, mockConfig, mockApi)
541+
542+
const mockDevice = {
543+
LockName: 'Test Lock',
544+
lockId: 'test-lock-id',
545+
hide_device: false,
546+
homeKitEnabled: true,
547+
overrideHomeKitEnabled: false,
548+
} as any
549+
550+
const result = await platform.registerDevice(mockDevice)
551+
552+
expect(result).toBe(false)
553+
expect(mockLog.error).toHaveBeenCalledWith(
554+
'Device: Test Lock already has HomeKit enabled. To register with Homebridge, add "overrideHomeKitEnabled": true to your device config.'
555+
)
556+
})
557+
558+
it('should NOT register device when hide_device is true', async () => {
559+
platform = new AugustPlatform(mockLog, mockConfig, mockApi)
560+
561+
const mockDevice = {
562+
LockName: 'Test Lock',
563+
lockId: 'test-lock-id',
564+
hide_device: true,
565+
homeKitEnabled: false,
566+
overrideHomeKitEnabled: false,
567+
} as any
568+
569+
const result = await platform.registerDevice(mockDevice)
570+
571+
expect(result).toBe(false)
572+
expect(mockLog.info).toHaveBeenCalledWith('[DEBUG]', 'Device: Test Lock is Hidden.')
573+
})
574+
})
501575
})

src/platform.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ export class AugustPlatform implements DynamicPlatformPlugin {
463463
await this.externalOrPlatform(device, accessory)
464464
this.accessories.push(accessory)
465465
} else {
466-
await this.debugErrorLog(`Unable to Register: ${device.LockName}, Lock ID: ${device.lockId} Check Config to see if is being Hidden.`)
466+
await this.warnLog(`Unable to Register: ${device.LockName}, Lock ID: ${device.lockId}. Check device configuration.`)
467467
}
468468
}
469469

@@ -477,8 +477,8 @@ export class AugustPlatform implements DynamicPlatformPlugin {
477477
+ `Override HomeKit Enabled: ${device.overrideHomeKitEnabled}`)
478478
} else if (device.homeKitEnabled && !device.overrideHomeKitEnabled) {
479479
this.registeringDevice = false
480-
await this.debugErrorLog(`Device: ${device.LockName} HomeKit Enabled: `
481-
+ `${device.homeKitEnabled}, device will not be registered. To enable, set overrideHomeKitEnabled to true.`)
480+
await this.errorLog(`Device: ${device.LockName} already has HomeKit enabled. `
481+
+ `To register with Homebridge, add "overrideHomeKitEnabled": true to your device config.`)
482482
} else {
483483
this.registeringDevice = false
484484
await this.debugLog(`Device: ${device.LockName} is Hidden.`)

0 commit comments

Comments
 (0)