aarons22 / homebridge-bond

Homebridge plugin for Bond
MIT License
64 stars 31 forks source link

0 devices found due to TypeError: Cannot convert undefined or null to object #110

Closed roycepope closed 3 years ago

roycepope commented 3 years ago

For some reason this plugin cannot find my Fan as a device. It is selecting the correct BOND hub (ZZBL47094) and in the BOND app I can see my Fan no problem.

Using homebridge-bond v3.0.0

[10/23/2020, 12:05:06 PM] [Bond] A request error occurred: undefined
[10/23/2020, 12:05:06 PM] [Bond] Error getting device ids: TypeError: Cannot convert undefined or null to object
[10/23/2020, 12:05:06 PM] [Bond] 0 cached accessories were loaded
[10/23/2020, 12:05:06 PM] [Bond] Getting devices for this Bond (ZZBL47094)...
[10/23/2020, 12:05:06 PM] [Bond] 0 devices were found on this Bond (ZZBL47094).
[10/23/2020, 12:05:06 PM] [Bond] No new devices to add for this Bond (ZZBL47094).

Any ideas? I am trying to get debug logging but I do not see the option in the homebridge-config-ui-x v4.30.0

aarons22 commented 3 years ago

Hi @roycepope - I just noticed the screenshots were broken in the Debug instructions, which I just fixed. You can find info for how to enable Debug Mode here: https://github.com/aarons22/homebridge-bond/wiki/Enabling-Debug-Mode#using-homebridge-ui

MsTreeWoman commented 3 years ago

same issue, with debug on. this seems to be an issue with 'deviceid'. i think it should be 'deviceId' (in the code).

/30/2020, 2:42:38 PM Bridge is running on port 51826. 10/30/2020, 2:42:38 PM (node:883) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'bondid' of undefined 10/30/2020, 2:42:38 PM at BondPlatform.getDevices (/home/hoobs/.hoobs/node_modules/homebridge-bond/dist/platform.js:46:65) 10/30/2020, 2:42:38 PM at /home/hoobs/.hoobs/node_modules/homebridge-bond/dist/platform.js:38:26 10/30/2020, 2:42:38 PM at Array.forEach () 10/30/2020, 2:42:38 PM at /home/hoobs/.hoobs/node_modules/homebridge-bond/dist/platform.js:37:28 10/30/2020, 2:42:38 PM at processTicksAndRejections (internal/process/task_queues.js:97:5) 10/30/2020, 2:42:38 PM (node:883) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 7) 10/30/2020, 2:42:38 PM (node:883) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

aarons22 commented 3 years ago

I think this may be the same issue https://github.com/aarons22/homebridge-bond/issues/116

It seems that hoobs is the common thread here, so I'll run it in hoobs and see what happens.

MsTreeWoman commented 3 years ago

{"target":"zermatt","fw_ver":"v2.15.1","fw_date":"Thu Oct 22 19:21:28 UTC 2020","uptime_s":43626,"boot_patch":"not outdated","make":"Olibra","model":"BD-1000","branding_profile":"ZERMATT","bondid":"ZZCJ13836","upgradehttp":true,"api":2,"":"e3786336"} MacBook-Pro-Early-2011:~ janet$ curl -H "BOND-Token: 4756a6004a44cf43" -i http://192.168.0.241/v2/devices HTTP/1.1 200 OK Content-Length: 102 Content-Type: application/json; charset=utf-8

{"":"e01e9a1c","4b5b7f49":{"":"cc504347"},"682e9e85":{"":"cdd3fafc"},"18be2248":{"":"7e15c4bf"}} MacBook-Pro-Early-2011:~ janet$

On Nov 7, 2020, at 9:16 AM, Aaron Sapp notifications@github.com wrote:

I think this may be the same issue #116 https://github.com/aarons22/homebridge-bond/issues/116 It seems that hoobs is the common thread here, so I'll run it in hoobs and see what happens.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aarons22/homebridge-bond/issues/110#issuecomment-723458123, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARPKSZIAJRM3Q4LJ7I2Z3PLSOVQGDANCNFSM4S45Y5NQ.

roycepope commented 3 years ago

Hi @aarons22 So when I try removing the bonds[], in my config I get the following:

[11/7/2020, 8:39:50 AM] [Bond] Initializing Bond platform...
[11/7/2020, 8:39:50 AM] [Bond] bonds array is required but missing from config.json

Can you take a look at my full config that is generated by default and let me know how the bond platform section should be modified?

{
    "bridge": {
        "name": "Homebridge",
        "username": "<REDACTED>",
        "port": 51826,
        "pin": "<REDACTED>"
    },
    "description": "This is an example configuration file with gui. You can use this as a template for creating your own configuration file containing devices you actually own.",
    "accessories": [
        {
            "accessory": "MagicHome",
            "name": "LED Strip",
            "ip": "192.168.0.88",
            "setup": "RGBWW",
            "purewhite": false
        }
    ],
    "platforms": [
        {
            "name": "Config",
            "port": 8124,
            "auth": "form",
            "theme": "auto",
            "tempUnits": "c",
            "lang": "auto",
            "sudo": true,
            "debug": false,
            "log": {
                "method": "file",
                "path": "/var/log/homebridge.log"
            },
            "platform": "config"
        },
        {
            "controllers": [
                {
                    "address": "192.168.0.101",
                    "password": "<REDACTED>",
                    "username": "homebridge"
                }
            ],
            "platform": "UniFi Protect"
        },
        {
            "bonds": [
                {
                    "ip_address": "192.168.0.35",
                    "token": "<REDACTED>"
                }
            ],
            "include_dimmer": false,
            "include_toggle_state": false,
            "fan_speed_values": false,
            "platform": "Bond"
        }
    ]
}
roycepope commented 3 years ago

Ok I figured it out! The Local Token shown in the app was incorrect! I had to curl the token following these steps: http://docs-local.appbond.com/#section/Getting-Started/Getting-the-Bond-Token