-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Recently I was running into this bizarre error whenever I ran anything to do with hue lights (e.g. hue lights on, hue lights off, etc.) on node v9.3.0, npm 5.6.0, & hue-cli 0.3.1.
I was about to ask for help here, but then I realized that the IP of my hue bridge changed, which may or may not have been the root of the problem. After re-registering hue-cli with the new configuration everything started working again. However, this original error message was pretty unhelpful in indicating that this might have been the problem. It could have been that the old IP was given to a different device on the local network and hue-cli was getting bogus data from it.
I'd suggest that this part of the code be adjusted so that, if the configuration stops working for some reason, it gives a more helpful error message stating something has changed with the connection, instead of leaving the user to scratch their head in confusion.
C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\hue-cli.js:141
var keys = Object.keys(lights);
^
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\hue-cli.js:141:25
at Request.<anonymous> (C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\hue-cli.js:342:5)
at Request._callback (C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\node_modules\hue.js\lib\Hue.js:36:43)
at Request.self.callback (C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\node_modules\request\main.js:122:22) at Request.emit (events.js:159:13)
at Request.<anonymous> (C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\node_modules\request\main.js:661:16)
at Request.emit (events.js:164:20)
at IncomingMessage.<anonymous> (C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\node_modules\request\main.js:623:14)
at IncomingMessage.emit (events.js:164:20)