ch-world / pimatic-hue

Plugin to control Philipps hue bulbs
GNU General Public License v2.0
4 stars 0 forks source link

Cannot read property 'state' of null #6

Closed Frederick-G764 closed 8 years ago

Frederick-G764 commented 8 years ago

Hi,

i recive the fowlling like every few sends. This error cause pimatic crash constantly. Maybe there is way to fix this?

error [pimatic]: A uncaught exception occured: TypeError: Cannot read property 'state' of null at process (/home/pi/pimatic-app/node_modules/pimatic-hue/node_modules/hue-module/lib/hue.js:111:37) at ClientRequest. (/home/pi/pimatic-app/node_modules/pimatic-hue/node_modules/hue-module/lib/http.js:92:6) at ClientRequest.EventEmitter.emit (events.js:95:17) at Socket.socketOnEnd as onend at Socket.g (events.js:180:16) at Socket.EventEmitter.emit (events.js:117:20) at _stream_readable.js:920:16 at process._tickCallback (node.js:415:13) This is most probably a bug in pimatic or in a module, please report it!

djmvt commented 8 years ago

Yeah same here, also when restarting the pi it gives alot of errors. I thought this was the same as the "bridge not present" error?

ch-world commented 8 years ago

The fix for handling bridge not reachable is not yet published to npm as there are some changes to the configuration. I will publish the new version to npm probably at the begin of next week. In the meantime feel free to checkout the development version from this repo. Take care of the configuration change: apikey is now called username to be conform with the hue guide.

@djmvt this sounds like pimatic starts before your network is up. With the dev version that shouldn't be a problem as the error gets handled properly. However that looks like the plugin should wait a moment after start before polling the states.

Frederick-G764 commented 8 years ago

Thanks for the quick answer and for the plugin :) I will try the dev version.

djmvt commented 8 years ago

Thanks!

BertusBeensteen commented 8 years ago

How do I install the dev version? Pimatic won't even start because of the "Cannot read property 'state' of null"-error please help

edit: I managed to copy some files over, but now i get the following errors: "Could not initialize the plugin "hue": Object # has no method 'lights' And "Error loading device hueBulb1: Promise is not defined"

ch-world commented 8 years ago

The dev version was using another library for communicating with the bridge thus you have to do a npm install in the plugin directory.

Take a look at https://forum.pimatic.org/topic/1114/updated-how-to-install-a-plugin-from-github. This guide explains how to install plugins from GitHub.

Btw. I updated the version at NPM.

BertusBeensteen commented 8 years ago

After manually updating the plugin using "sudo npm install pimati-hue" from the /home/pi/pimatic-app/node_modules/ foder, the plugin started working again. Thanks for the help!