octoblu / gateblu-forever

Gateblu using forever to run devices in their own processes
http://gateblu.octoblu.com
MIT License
2 stars 3 forks source link

Can't connect other things to gateblu #11

Open ajagnanan opened 8 years ago

ajagnanan commented 8 years ago

Hello, I have gateblu-forever installed on a linux vm. This part works and I see the thing "gateblu" online in octoblu. When I try to connect a wemo or hue to it though, it fails on "Loading Device Options..." with no error message in logs. In octoblu's browser console, I see it making requests for a status, this is the output:

{
    "gateblu": "451167b3-5814-4cc1-84f1-99a0a505c410",
    "type": "device:hue-light",
    "category": "device",
    "connector": "meshblu-hue-light",
    "initializing": true,
    "sendWhitelist": [],
    "receiveWhitelist": [],
    "configureWhitelist": ["451167b3-5814-4cc1-84f1-99a0a505c410", "ee5f4b61-4127-4c99-ba71-86d420570994", "ee5f4b61-4127-4c99-ba71-86d420570994"],
    "discoverWhitelist": ["451167b3-5814-4cc1-84f1-99a0a505c410", "ee5f4b61-4127-4c99-ba71-86d420570994", "ee5f4b61-4127-4c99-ba71-86d420570994"],
    "sendAsWhitelist": ["451167b3-5814-4cc1-84f1-99a0a505c410"],
    "receiveAsWhitelist": ["451167b3-5814-4cc1-84f1-99a0a505c410"],
    "configureAsWhitelist": [],
    "discoverAsWhitelist": [],
    "owner": "xxx",
    "uuid": "xxx",
    "online": false,
    "token": "xxx",
    "meshblu": {
        "createdAt": "2016-04-27T01:11:46+00:00",
        "hash": "aVYZyF/5x80yjEZ0gmZo+IwHzJj8mioAsRPpMmToj6s="
    }
}

Am i missing a step? or is there somewhere else i should check for an error? Thanks.

anhldbk commented 8 years ago

@ajagnanan Actually I think the code of gateblu-forever does NOT work as stated Gateblu using forever to run devices in their own processes

Please have a look at device-manager.coffee. The function spawnChildProcess is not executed in run-time.

So, guess what? This repo is not ready for you to deploy on your own hardware.

brianehlert commented 8 years ago

There are specific setup instructions to get gateblu-forever working on Linux (I run it on Ubuntu all the time). The intention of the build if for RaspberryPi actually, so a few modifications need to be made for other Linux distros. The biggest hitch is that some of the dependent npm modules require node-pre-gyp which assumes python 2.7, if you have python 3 it will be all broken.

The steps I follow for Ubuntu are here: https://gist.github.com/brianehlert/6b7fa7c86be098722d73f944e96b1bf9

ajagnanan commented 8 years ago

Hi @brianehlert, can you actually get devices added to it afterwards? I got gateblu running and registered to octoblu, I just had issues with getting devices registered.

anhldbk commented 8 years ago

@ajagnanan Well, the code is not fully functional.

ajagnanan commented 8 years ago

Ok thought so. In the mean time, I have node-red registered to octoblu and running on my local network. Thats an alternative for now at least.

brianehlert commented 8 years ago

@ajagnanan Yes. Yes, I can add devices afterward. I frequently work with the Hue for testing various things and that plug-in npm module has some sub dependencies that frequently cause it to fail properly installing. Beyond that.. There have been bugs in the past where pushing new modules / plug-ins / device from the cloud service has failed. Those have generally been cloud service side issues and I hope that is not what you are running in to.

ajagnanan commented 8 years ago

I'll try again to test out. Thanks

anhldbk commented 8 years ago

@ajagnanan There's another thing I must tell you: in addition to not being activated, your plugin instances may NOT receive any message from meshblu (with the current repo).

Want a proof? Well, if you follow the tutorial Building A Custom Connector, it states that:

In the Plugin.prototype.onMessage function, define how you want your device to behave when it receives a message

If you search for onMessage in gateblu or gateblu-forever codebase, you'll get nothing at all.

brianehlert commented 8 years ago

@anhldbk onMessage is what your device sends to meshblu. It does not register it with Gateblu. Gateblu is simply a proxy to meshblu. Gateblu is for those devices that cannot talk directly to meshblu - such as Bluetooth or locally attached devices. No different than a hardware IoT gateway to get LAN devices bridged to some cloud service.

Otherwise your device directly registers with and directly connects to Meshblu.

Also, not making any claims that the docs are not out of date. As I know some are.

There are a number of the 'connectors' listed on that readme.io page that do not use Gateblu at all. They connect directly with Meshblu.

Gateblu specific connectors are mentioned here: https://gateblu.readme.io/docs/connectors

anhldbk commented 8 years ago

@brianehlert I see. Thank you for your thorough explanation.

royvandewater commented 8 years ago

Each of the devices that run on the Gateblu have their own connection to Meshblu, so they all handle onMessage on their own. Gateblu doesn't take any action onMessage since pretty much everything it does is handled onConfig.