Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin config.json shown in Advanced editor does not match contents seen by plugin #1853

Closed
2 of 4 tasks
jlg89 opened this issue Feb 7, 2023 · 2 comments
Closed
2 of 4 tasks
Labels
bug Something isn't working discovery Issues reported without enough information

Comments

@jlg89
Copy link

jlg89 commented Feb 7, 2023

Description
The homebridge-august plugin uses a validation process to register the plugin with the August mothership. When I follow this process and add the "validateCode" line to the config using the "Advanced" editor, and then restart the bridge, the plugin adds an "isValidated": true line to config.json. When I view the config.json in HOOBS Advanced editor, 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. IOW that line appears in the HOOBS web interface, but not in the file in the filesystem. According to Donovan Becker, this is a HOOBS issue, and of course his solution is to use stock homebridge and config-ui-x. It's not my intention to get into that debate, nor do I want to have to reconfigure everything from scratch.

Version
4.2.8

Did you upgrade

  • No

What device are you using?
Please let us know the device you are running HOOBS on.

  • HOOBS Box
  • HOOBS SD Card
  • Custom Install

List your plugins
homebridge-august
homebridge-camera-ffmpeg
homebridge-tcc
homebridge-tplink-smarthome

Post your config
This can be found in the interface, Configuration -> Advanced or you can get it via SSH cat ~/.hoobs/etc/config.json

{
    "accessories": [],
    "platforms": [
        {
            "platform": "August",
            "name": "August",
            "credentials": {
                "augustId": "xxx",
                "password": "xxx",
                "notice": "Keep your tokens a secret!",
                "validateCode": "123456",
                "logging": "debug",
                "isValidated": true
            },
            "options": {
                "devices": [
                    {
                        "lockId": "xxx",
                        "hide_device": false,
                        "lock": {
                            "hide_contactsensor": true
                        }
                    }
                ]
            }
        }
    ]
}

Post your log
You can get the log from the interface. This is in the Log section.

2/6/2023, 8:25:31 PMDoor Access Bridge starting
2/6/2023, 8:25:34 PMDoor Access BridgeERROR�[31mThe plugin "homebridge-august" requires a Homebridge version of ^1.6.0 || ^2.0.0-beta.0 which does not satisfy the current Homebridge version of 1.5.0. You may need to update this plugin (or Homebridge) to a newer version. You may face unexpected issues or stability problems running this plugin.�[39m
2/6/2023, 8:25:36 PMDoor Access BridgeLoaded plugin 'homebridge-august'
2/6/2023, 8:25:36 PMDoor Access BridgeLoading 1 platforms...
2/6/2023, 8:25:36 PMDoor Access BridgeAugustERRORDiscover Devices: ReferenceError: Config errors found:
Missing config.installId or AUGUST_INSTALL_ID env var
2/6/2023, 8:25:36 PMDoor Access BridgeBridge is running on port 51846.

Additional context
Add any other context about the problem here.

@jlg89 jlg89 added bug Something isn't working discovery Issues reported without enough information labels Feb 7, 2023
@jlg89
Copy link
Author

jlg89 commented Feb 8, 2023

HOOBS is doing something that keeps the plugin from making the necessary edits to its config.json file. Specifically, it should be adding an "installID" line and removing the "validateCode" line, but that isn't happening.

@jlg89
Copy link
Author

jlg89 commented Feb 9, 2023

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.

@jlg89 jlg89 closed this as completed Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discovery Issues reported without enough information
Projects
None yet
Development

No branches or pull requests

1 participant