davidcreager / smartthings-smartbulbs

A server to intermediate between smartthings and mipow or yeelight smartbulbs. Also the smartapp and devicehandler groovy files
18 stars 20 forks source link

error #3

Open armacali opened 7 years ago

armacali commented 7 years ago

osmc@osmcstar:/var/opt/node/smartthings-smartbulbs$ sudo systemctl status smartbulbserver

Aug 03 22:39:53 osmcstar smartbulbserver.js[1591]: at Object.Module._extensions..js (module.js:580:10) Aug 03 22:39:53 osmcstar smartbulbserver.js[1591]: at Module.load (module.js:503:32) Aug 03 22:39:53 osmcstar systemd[1]: smartbulbserver.service: main process exited, code=exited, status=1/FAILURE Aug 03 22:39:53 osmcstar systemd[1]: Unit smartbulbserver.service entered failed state. Aug 03 22:39:53 osmcstar systemd[1]: smartbulbserver.service holdoff time over, scheduling restart. Aug 03 22:39:53 osmcstar systemd[1]: Stopping node.js server to manage yeelight and miPow bulbs... Aug 03 22:39:53 osmcstar systemd[1]: Starting node.js server to manage yeelight and miPow bulbs... Aug 03 22:39:53 osmcstar systemd[1]: smartbulbserver.service start request repeated too quickly, refusing to start. Aug 03 22:39:53 osmcstar systemd[1]: Failed to start node.js server to manage yeelight and miPow bulbs. Aug 03 22:39:53 osmcstar systemd[1]: Unit smartbulbserver.service entered failed state.

ajw107 commented 7 years ago

Hi, I'm getting the same error, ran manually it's something to do with the pre-compiled bluetooth binding (could this be a 64bit vs 32bit problem, I'm using Ubuntu 17.04 64bit). Here's the full error message:

module.js:598
  return process.dlopen(module, path._makeLong(filename));
                 ^
Error: /var/opt/node/smartthings-smartbulbs/node_modules/bluetooth-hci-socket/build/Release/binding.node: wrong ELF class: ELFCLASS32
    at Object.Module._extensions..node (module.js:598:18)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/var/opt/node/smartthings-smartbulbs/node_modules/bluetooth-hci-socket/lib/native.js:3:15)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
ajw107 commented 7 years ago

Edited 5 March 2018: Just had to reinstall this again on a new server and ran into the same problem and realised I'd missed off a few steps, sorry here's the new version: Okay, think I've got it solved. The problem is that the node_modules directory is not supposed to be included, and should be generated on each individual machine. Only takes a few extra steps:

If it runs, fab, press ctrl+c to exit, if it complains that it can't find a module, install it using npm install, as above. There maybe a better way to do all this (I've not used nodejs knowingly before), but this way seems to work.

../pws.json

Also, if you are running into a problem where it can;t find pws.json this is caused because the 'FindMyIphone' functionality added into the software requires this as a file that contains your appleid and password in json format (no idea why smartbulb software needs this really). My best solution is to comment out the few lines in smartbulbserver.js that use this. The lines are 175-178:

                              } else if  (tmpTypeDetails.agent == "FindIphone")  {
                                      agents[tmpTypeDetails.agent] = new
require("./FindIphone").FindIphone(handleAgentEvents);
                                      console.log("smartbulbserver: " + "Working for "
+ type  + " agent started " + tmpTypeDetails.agent );
                                      agents[tmpTypeDetails.agent].discoverDevices();

becomes:

//                              } else if  (tmpTypeDetails.agent == "FindIphone")  {
//                                      agents[tmpTypeDetails.agent] = new
require("./FindIphone").FindIphone(handleAgentEvents);
//                                      console.log("smartbulbserver: " + "Working for "
+ type  + " agent started " + tmpTypeDetails.agent );
//                                      agents[tmpTypeDetails.agent].discoverDevices();

and that should get rid of that problem.

rfxcom

If you also run into it needing the rfxcom module, which is a great little module for communicating to anything on the 433MHz range, such as X10, Lightwave, etc. The smartbulbs DO NOT use this frequency, so you can either safely remove the references to it in lines 179-182 in the same way as you did for FindIphone above, or install the rfxcom module using npm install rfxcom

Hope this all helps. Alex

thedesp commented 7 years ago

I installed the server on RPi 3 and can confirm the error and fix provided by @ajw107 above.

It seems the modules in node_modules directory cloned via github are mismatch with the version of node.js binary on each installation (I installed node.js following this instruction https://raspberrypi.stackexchange.com/a/48313 using updated node.js package.).

You have to compile the modules yourself for it to work.

@davidcreager Could you exclude the node_modules from master branch as it seems to cause problem?

rotahn commented 6 years ago

having real issues installing this lol.

cloned the git, deleted the nodes_modules dir, ran the above npm installs..

so far i've had to install... sudo npm install node-milight-promise sudo npm install request sudo npm install tough-cookie

im stuck on the '../pws.json' module though. Can't seem to figure out how to install it or what it is!

any help would be appreciated.

davidcreager commented 6 years ago

Aha Sorry...I am such a GitHub newbie.....you really need to use tag v1. the rest of the branches are under development........

rotahn commented 6 years ago

yeah im a github newbie too.. even using it make my brain hurt :)

i've cloned the v2 branch but i cant even get past the setup instructions lol...

yeelight-smartthings.service isnt in the directory...i assume it might be called smartbulbserver.service now? config.json .. it's hiding somewhere im sure :)

thanks for your help..

rotahn commented 6 years ago

ignore me..i cloned v2...i thought i read i could use v2 also.. i will start again :)

davidcreager commented 6 years ago

I am beginning to get the hang of it.....and will be sorting this total mess out in a few weeks. (sorry all!) I think the way to go at the moment is git clone https://github.com/davidcreager/smartthings-smartbulbs.git git checkout tags/v1.0

Tag v2.0 might work....I cant remember.....

rotahn commented 6 years ago

much appreciated.. i might wait until the housekeeping is done :)

I just can't believe that smartthings refuses to support these out of the box tbh. Im really grateful to you in taking your time to write this. While i'm new to smartthings i've been dabbling with automation for a little bit using homeassistant, in which, the yeelights also work because of guys like you.

blades commented 6 years ago

fyi, the latest version of node (10.7) and the current version of bluetooth-hci-socket are currently incompatible and it won't compile. bit of a pain, really - you'll have to use an older version for the moment until the library is fixed.