szokeptr / homebridge-tradfri-plugin

Ikea Tradfri plugin for Homebridge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnhandledPromiseRejectionWarning

frhogdevelop opened this issue · comments

(node:3396) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token A in JSON at position 0
(node:3396) 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.

Ive been getting this error for two days now. I have completley removed nodejs and homebridge just to install everything again. when i first install it with only telldus plugin it work just fine, i then install tradfri-plugin but does not add config for tradfri, still works. The second i add tradfri to the json and try to start homebridge i get this error. I will add my configfile.

config.zip

I get the same error, both with node 6.9.1 and 6.9.2.
The bulbs respond and i can dim them for 5-10 minutes, then the error above occurs and the bulbs stop responding.

Been trying out different node versions, had major issues with 7.9.0 (the reason I started trying different versions in the first place). A complete reinstall of 7.9.0 seems to solve my problems.
Now only running homebridge with tradfri-plugin and harmonyhub.

It looks like sometimes the gateway is not giving a response and the coap-client command exits. This is when this promise rejection error comes up. I have a fix in mind, if that works I will publish a new version.

I get the same error on startup of homebridge, no other plugins in config.json

This is what Terminal says:
Mac-mini:~ Tobtech$ homebridge [4/20/2017, 4:31:11 PM] Loaded plugin: homebridge-tradfri [4/20/2017, 4:31:11 PM] Registering platform 'homebridge-tradfri.Tradfri' [4/20/2017, 4:31:11 PM] --- [4/20/2017, 4:31:11 PM] Loaded plugin: homebridge-tradfri-plugin [4/20/2017, 4:31:11 PM] Registering platform 'homebridge-tradfri.IkeaTradfri' [4/20/2017, 4:31:11 PM] --- [4/20/2017, 4:31:11 PM] Loaded config.json with 0 accessories and 1 platforms. [4/20/2017, 4:31:11 PM] --- [4/20/2017, 4:31:11 PM] Loading 1 platforms... [4/20/2017, 4:31:11 PM] [Tradfri] Initializing IkeaTradfri platform... [4/20/2017, 4:31:11 PM] Loading 0 accessories... Load homebridge-tradfri.Tradfri [4/20/2017, 4:31:11 PM] [homebridge-tradfri.Tradfri] Using COAP client binary: /usr/local/lib/node_modules/homebridge-tradfri/dist/tradfri/../../bin/coap-client-darwin [4/20/2017, 4:31:11 PM] [homebridge-tradfri.Tradfri] GET: coaps://192.168.1.124:5684/15001/ <Buffer 41 70 72 20 32 30 20 31 36 3a 33 31 3a 31 31 20 41 4c 52 54 20 32 30 20 69 6e 76 61 6c 69 64 61 74 65 20 70 65 65 72 0a> (node:1207) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token A in JSON at position 0 npm uninstall homebridge-tradfri

And this is what my config.json looks like:
`{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},

"description": "This is Tobias Homebridge",

"accessories": [],

"platforms": [{

"platform": "IkeaTradfri",

"name": "Tradfri",
"host": "192.168.1.124",
"key": "1n7canv0oar4fc5t"

}]
}
`

Please advice

@szokeptr Im ready to test if you manage to make new version.

you should try with node 7 as its recommended by homebridge

I am using node 7. been trying with as many node versions as i can get to work

I get the same error. Node 7.9.0

(node:1188) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token v in JSON at position 0
(node:1188) 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.
(node:1188) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): SyntaxError: Unexpected token v in JSON at position 0

I used to have Harmony Hub installed, but that just kept crashing homebridge, so it's only this plugin installed at the moment.

I solved my issue!
It seems to be related to when the plugin cannot connect to the Trådfri bridge.
My issue was that I had all characters in the "key":"xxxxx" small.
Check that you have the exact characters that are written under your Trådfri gateway with numbers, small and large letters. If still not working, provide config.json

My key is exactly as on the label, but alas, I still have the problem.

20NWbkqrqlzR6NNd

i can recommend to use the qr code with the phone and copy paste it to avoid errors

I pushed a new version that addresses problems with promise rejection. Please update the plugin to 1.0.6 and double check your IP and PSK (not: the PSK is case sensitive) and let me know if it works.

Well, something fixed it, i reinstalled everything with new config and this new version. I cant say if the version or fixed config fixed it but i scanned the QR code on the back of the gateway and it was exactly how i wrote it. The point is, it works now.