aarons22 / homebridge-bond

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

Issue with 'bondid' in code - not found. full debug list included. #116

Closed MsTreeWoman closed 4 years ago

MsTreeWoman commented 4 years ago

Describe the bug Appears to not recognize keyword/variable 'bondid'. i've seen bondid in the code as 'bondid' and 'bondId', but i'm not sure this is what is causing this issue. This seems to cause the program to malfunction in the process of starting up. It appears that 'undefined' should be replaced by the IP address of the BOND unit, which on my network is 192.168.0.241 (static IP).

Information (please complete the following information):

Configuration:

[ { "platform": "Bond", "bonds": [ { "ip_address": "192.168.0.241", "token": "XXXXXXXXXXXXX", } ] } ]

Logs 11/5/2020, 7:41:27 PM [Bond] Initializing Bond platform... 11/5/2020, 7:41:27 PM [Bond] Request (185d66cdccdc4000) [get http://undefined/v2/devices] 11/5/2020, 7:41:27 PM [Bond] Request (185d66cdccdd0000) [get http://undefined/v2/sys/version] 11/5/2020, 7:41:27 PM [Bond] Error (185d66cdccdc4000) [get http://undefined/v2/devices] - {"code":"ERR_HTTP_INVALID_HEADER_VALUE"} 11/5/2020, 7:41:27 PM [Bond] A request error occurred: undefined 11/5/2020, 7:41:27 PM [Bond] Error (185d66cdccdd0000) [get http://undefined/v2/sys/version] - {"code":"ERR_HTTP_INVALID_HEADER_VALUE"} 11/5/2020, 7:41:27 PM [Bond] A request error occurred: undefined 11/5/2020, 7:41:27 PM [Bond] Error getting version: TypeError: Cannot read property 'bondid' of undefined 11/5/2020, 7:41:27 PM [Bond] Error getting device ids: TypeError: Cannot convert undefined or null to object 11/5/2020, 7:41:27 PM [Bond] Config: {"platform":"Bond","plugin_map":{"plugin_name":"homebridge-bond"},"include_dimmer":false,"include_toggle_state":false,"fan_speed_values":false,"bonds":[{"platform":"Bond","bonds":[{"ip_address":"192.168.0.241","token":"4756a6004a44cf43","hide_device_ids":false}]}]} 11/5/2020, 7:41:27 PM [Bond] 0 cached accessories were loaded 11/5/2020, 7:41:27 PM Bridge is running on port 51826. 11/5/2020, 7:41:27 PM (node:569) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'bondid' of undefined 11/5/2020, 7:41:27 PM at BondPlatform.getDevices (/home/hoobs/.hoobs/node_modules/homebridge-bond/dist/platform.js:46:65) 11/5/2020, 7:41:27 PM at /home/hoobs/.hoobs/node_modules/homebridge-bond/dist/platform.js:38:26 11/5/2020, 7:41:27 PM at Array.forEach () 11/5/2020, 7:41:27 PM at /home/hoobs/.hoobs/node_modules/homebridge-bond/dist/platform.js:37:28 11/5/2020, 7:41:27 PM at processTicksAndRejections (internal/process/task_queues.js:97:5) 11/5/2020, 7:41:27 PM (node:569) 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) 11/5/2020, 7:41:27 PM (node:569) [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 4 years ago

Looks like you have "hide_device_ids": false in your config, which is an incorrect value for that key (it expects something like "hide_device_ids": ["123"]. Can you remove that and try again?

The plugin doesn't use the bondID to make the http request but instead uses the ip_address from the config, so it's possible the incorrect config is causing an issue.

MsTreeWoman commented 4 years ago

Actually, most of the time i did not have that in (put it in in case it fixed the issue). took it out, the issue remains:

11/6/2020, 8:11:55 PM [Bond] Initializing Bond platform... 11/6/2020, 8:11:55 PM [Bond] Request (185d681e5cbc4000) [get http://192.168.0.241/v2/devices] 11/6/2020, 8:11:55 PM [Bond] Request (185d681e5cbd0000) [get http://192.168.0.241/v2/sys/version] 11/6/2020, 8:11:55 PM [Bond] Error (185d681e5cbc4000) [get http://192.168.0.241/v2/devices] - {"code":"ERR_HTTP_INVALID_HEADER_VALUE"} 11/6/2020, 8:11:55 PM [Bond] A request error occurred: undefined 11/6/2020, 8:11:55 PM [Bond] Error (185d681e5cbd0000) [get http://192.168.0.241/v2/sys/version] - {"code":"ERR_HTTP_INVALID_HEADER_VALUE"} 11/6/2020, 8:11:55 PM [Bond] A request error occurred: undefined 11/6/2020, 8:11:55 PM [Bond] Error getting version: TypeError: Cannot read property 'bondid' of undefined 11/6/2020, 8:11:55 PM [Bond] Error getting device ids: TypeError: Cannot convert undefined or null to object 11/6/2020, 8:11:55 PM [Bond] Config: {"platform":"Bond","plugin_map":{"plugin_name":"homebridge-bond"},"include_dimmer":false,"include_toggle_state":false,"fan_speed_values":false,"bonds":[{"platform":"Bond","bonds":[{"ip_address":"192.168.0.241","token":"4756a6004a44cf43"}]}]} 11/6/2020, 8:11:55 PM [Bond] 0 cached accessories were loaded 11/6/2020, 8:11:55 PM Bridge is running on port 51826. 11/6/2020, 8:11:55 PM (node:3423) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'bondid' of undefined 11/6/2020, 8:11:55 PM at BondPlatform.getDevices (/home/hoobs/.hoobs/node_modules/homebridge-bond/dist/platform.js:46:65) 11/6/2020, 8:11:55 PM at /home/hoobs/.hoobs/node_modules/homebridge-bond/dist/platform.js:38:26 11/6/2020, 8:11:55 PM at Array.forEach () 11/6/2020, 8:11:55 PM at /home/hoobs/.hoobs/node_modules/homebridge-bond/dist/platform.js:37:28 11/6/2020, 8:11:55 PM at processTicksAndRejections (internal/process/task_queues.js:97:5) 11/6/2020, 8:11:55 PM (node:3423) 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) 11/6/2020, 8:11:55 PM (node:3423) [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. 11/6

aarons22 commented 4 years ago

Looks like we're making some progress because the IP Address is now showing up in the request url. Now we just need to figure out why the first two requests are returning {"code":"ERR_HTTP_INVALID_HEADER_VALUE"}. Until that is fixed, the rest of the requests are going to fail.

Assuming you are on a Mac, can you run these commands in terminal and let me know what the output is?

curl -i http://192.168.0.241/v2/sys/version
curl -H "BOND-Token: 4756a6004a44cf43" -i http://192.168.0.241/v2/devices
MsTreeWoman commented 4 years ago

Actually, I hard coded the up address in the Java code to get around the problem but sorry I’m confusing the issue.

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

Looks like we're making some progress because the IP Address is now showing up in the request url. Now we just need to figure out why the first two requests are returning {"code":"ERR_HTTP_INVALID_HEADER_VALUE"}. Until that is fixed, the rest of the requests are going to fail.

Assuming you are on a Mac, can you run these commands in terminal and let me know what the output is?

curl -i http://192.168.0.241/v2/sys/version

curl -H "BOND-Token: 4756a6004a44cf43" -i http://192.168.0.241/v2/devices

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aarons22/homebridge-bond/issues/116#issuecomment-723457774, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARPKSZLWHFYNCFK2WI4X3BDSOVPZPANCNFSM4TMDMTXQ .

aarons22 commented 4 years ago

All good! I think I've identified your issue. In HOOBS, you don't need to include "bonds": [] in your configuration. Here is how it should appear:

image

Based on the logs you provided, it looks like you may have it setup like this: image

roycepope commented 4 years ago

@aarons22 Do you think this will resolve my issue you referenced above?

aarons22 commented 4 years ago

Possibly! I replicated the issue by using the invalid config. I actually had to uninstall the plug-in to get Hoobs to clear cached accessories, because I was still seeing issues after fixing the config.

I'm hoping to release a fix in the near future that will validate the config.

MsTreeWoman commented 4 years ago

That totally worked. I think we should close this and update the readme?

aarons22 commented 4 years ago

@MsTreeWoman definitely! I'm also going to file a bug with hoobs because the UI should be using the template the plug-in provides to prevent something like this

aarons22 commented 4 years ago

I updated the README and requested a new feature on HOOBS to make this a little more clear: https://github.com/hoobs-org/HOOBS/issues/895