donavanbecker / homebridge-august

The Homebridge August plugin allows you to access your August/Yale Locks from HomeKit with Homebridge.
ISC License
35 stars 8 forks source link

Bug: Can’t discover 3rd gen lock with august connect #41

Closed ctaylora1231 closed 1 year ago

ctaylora1231 commented 1 year ago

Describe The Bug

The device cannot be added to the plugin with the error [August] Discover Devices: TypeError: Cannot convert undefined or null to object

To Reproduce

install homebridge on pi4, install the plugin. input username/password, restart homebridge,input verification code sent from August, restart homebridge.

Expected behavior

Device discovered, controllable through HomeKit

Relevant log output

17/12/2022, 19:55:14] [AugustLocks] [August] getting locks ...
[17/12/2022, 19:55:14] [AugustLocks] [August] Could not communicate with August API: Config errors found:
Missing config.installID or AUGUST_INSTALLID env var

Config for homebridge-august

{
            "name": "August",
            "credentials": {
                "augustId": "********@me.com",
                "password": "*********",
                "installId": "********,
                "notice": "Keep your tokens a secret!",
                "isValidated": true
            },
            "platform": "August"
        }

Screenshots

No response

Device & Model

August lock 3rd gen with August Connect

Node.js Version

V18.12.1

NPM Version

V8.19.2

Homebridge Version

V1.6.0

Homebridge August Plugin Version

V1.1.0

Homebridge Config UI X Plugin Version

v4.50.2

Operating System

Raspbian bullseye (11)

donavanbecker commented 1 year ago

based off the error, I would remove you installID and isValidated, from the config and then start fresh

ctaylora1231 commented 1 year ago

Doing so just makes it to go through the validation process again

jlg89 commented 1 year ago

Same thing going on here with an existing working install, been fine for quite awhile and then started throwing the error mentioned above:

12/26/2022, 4:30:36 AMDoor Access BridgeAugustERRORDiscover Devices: ReferenceError: Config errors found:
Missing config.installId or AUGUST_INSTALL_ID env var

Lock actions & statuses seem to not be working. Something to do with the latest iOS updates, maybe? I haven't upgraded HomeKit to the new architecture, but have updated things to the latest iOS & tvOS. I have tried removing validateCode and isValidated and redoing the validation code, but the error returns.

Homebridge 1.5.0 Node 16.19.0 plugin v1.1.0

{
    "platform": "August",
    "name": "August",
    "credentials": {
        "augustId": "x@x",
        "password": "xxxxxxxxxxx",
        "validateCode": "xxxxxx",
        "isValidated": true
    },
    "options": {
        "devices": [
            {
                "lockId": "xxxxxxxxxxxxxxxx",
                "hide_device": false,
                "lock": {
                    "hide_contactsensor": true
                }
            }
        ]
    }
}
dwyeraidan commented 1 year ago

I'm having this same problem with my lock now too.

My lock recently had a firmware upgrade available - and I thought this broke it. But I'm seeing the same InstallID error as above so probably not the new firmware.

ctaylora1231 commented 1 year ago

I have installed/reinstalled homebridge and this august plug-in on 2 different pi's multiple times. I have reset and repaired my august lock in the august app. I have unplugged and reset August Connect, eero router, hubs. And I continue to have the same issues.

Discover Devices: TypeError: Cannot convert undefined or null to object

I know it can work, I have faith that we can get it to work. I just can't figure out how. I have even tried editing config file via command line rather than homebridge ux with no luck. Any help would be grateful

Only thing I can come up with but I hope I'm wrong is august has blocked my IP address due to so many install attempts. I have seen that issue a rise before on a now archived august plug-in. See the last comment by plugin developer; https://github.com/blaineam/homebridge-august-smart-locks/issues/41

jlg89 commented 1 year ago

Still happening here, I go through the validation steps, add the validateCode to the config, restart the bridge. I see that "isValidated": true gets added to the config, and everything works. Then at some point -- seems to happen here when the Pi restarts -- the "Discover Devices: ReferenceError: Config errors found: Missing config.installId or AUGUST_INSTALL_ID env var" error appears in the log, and the locks in HomeKit no longer work. Wash, rinse, repeat.

It seems like the plugin is losing its validated status with the August server, somehow.

jlg89 commented 1 year ago

Interesting discovery here. This is under HOOBS** but it's worth checking in config-ui-x as well. When I do the validation steps and then add the "validateCode" line to config.json, the plugin then adds the "isValidated" line to config.json when the bridge restarts. When I view the config.json in HOOBS, everything looks good, but if I look at the file in /var/lib/hoobs/[bridge name]/config.json, the "validateCode" line is not in there. I've added it manually, we'll see if it survives a restart. No idea what's up with that. Maybe it's a HOOBS-related oddity, maybe there's an issue with the config edit process in the plugin?

** Go ahead and cuss me, I started with HOOBS before config-ui-x was up to snuff. Migrating to "real" homebridge is on my to-do list.

donavanbecker commented 1 year ago

Yep, plug-in is designed to add that, but only with config-ui-x and no plans to add HOOBs support. Sorry.

jlg89 commented 1 year ago

It does add the "isValidated" line as it should, but somehow the "validateCode" line gets eliminated at the same time -- yet that line is there in the ("Advanced") GUI editor. That's what's really confusing.

donavanbecker commented 1 year ago

Yep HOOBs issue though.

jlg89 commented 1 year ago

I'm willing to compensate you for your time, if you can make it work even though it's a HOOBS issue.

donavanbecker commented 1 year ago

I don't have to the time to support both UIs, I'm sorry.

jlg89 commented 1 year ago

Not a straightforward fix, but this works for getting this plugin to run under HOOBS 4.2.8. Maybe HOOBS 4.3 will fix this, but I'm not holding my breath.

The trick is getting the august-api node module to give you the installId value, which is not getting written to the config.json for whatever reason.

Edit /var/lib/hoobs/[child_bridge_name]/node_modules/august-api/src/util/session.js

At the end of the file, find:

  headers['x-august-access-token'] = this.token
  console.log('Using installId: ', installId)                 <—insert this line & save
  return headers

Restart the bridge containing the homebridge-august plugin. You’ll have to go back through the authentication steps, but the installId should start showing up in the HOOBS debug log (not the plugin’s debug log, you have to enable debug on the HOOBS log page).

Once you have the installId, edit the homebridge-august plugin config (using the Advanced editor). Replace the “validateCode”: “123456" line with “installId”: “your-installId-string” and save it. The plugin should now work properly, and survive restarts.

You can leave the session.js file as-is, but I’d revert it to the original, as it’s pretty chatty with that console.log line in there.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 year ago

This issue has been closed as no further activity has occurred.