Giter Club home page Giter Club logo

bean-sdk-node's Introduction

Bean SDK for Node.js

Circle CI

Welcome to the Node.js SDK and CLI source code repo for the LightBlue Bean/Bean+.

Documentation:

Installation

Follow one of our detailed install guides!

CLI

This project ships with a full-featured CLI that can talk to the Bean/Bean+ without needing to write a single line of code.

SDK/Library

API reference and examples coming soon!

Basic usage can be found in examples/set_led.js

bean-sdk-node's People

Contributors

gsundin avatar mplewis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bean-sdk-node's Issues

firmware_bundles are obsolete

The most recent commit (72eca92) updated firmware to rev 201611070000, whereas current Bean Loader apps require rev 201611160000.

In a possibly related issue, the bean program_firmware command does not fail-fast if the bean's firmware is more recent than the revision in the SDK's firmware_bundles. Instead it proceeds, but does not complete:

[...]
2017-03-21T00:39:41.915Z INFO All services have been setup!
Connected!

2017-03-21T00:39:41.946Z INFO Char read success(2a27): 2A
Programming device firmware: 884aea153e0a
2017-03-21T00:39:41.952Z INFO Begin update called
2017-03-21T00:39:41.975Z INFO Char read success(2a26): 201611160000 Img-B
2017-03-21T00:39:41.976Z INFO Comparing firmware versions: Bundle version (201611070000), Bean version (201611160000)
2017-03-21T00:39:41.979Z INFO Starting FW update for device Bean+(884aea153e0a)
2017-03-21T00:39:41.981Z INFO Begin FW @ 1490056782
2017-03-21T00:39:41.984Z INFO Triggered a notification on Identify char

The command appears to hang at this point and must be manually terminated.

Another possibly related bug is that the bean program_sketch command also hangs. This has been reported several times recently in the forum:

2017-03-21T00:42:35.289Z INFO All services have been setup!
Connected!

2017-03-21T00:42:35.318Z INFO Char read success(2a27): 2A
Found sketch setLed for board Bean+
2017-03-21T00:42:35.328Z INFO No longer scanning...
2017-03-21T00:42:35.331Z INFO State transition: null -> STATE_INACTIVE
2017-03-21T00:42:35.331Z INFO Beginning sketch upload of sketch: setLed
2017-03-21T00:42:35.332Z INFO State transition: STATE_INACTIVE -> STATE_AWAIT_READY
2017-03-21T00:42:35.333Z INFO Sketch upload started!

Once again, the command appears to hang at this point and must be manually terminated.

Other commands that hang are: read_accel, read_ble_config, and read_device_info.

I wonder if the hangs are related to the firmware version? It seems unlikely that they are related to BLE dongle because the hangs have been reported when using several different approved dongles.

windows 10
python 2.7.13
node v6.10.0
bean 0.6.1

readAccelerometer(callback) is not a function

Hi all,
I tried to modify the setLed example to read the accelerometer info from the bean +, I changed 1 line in the code, from bean.setLed(0, 255, 0, (err)=> { to bean.readAccelerometer((err)=> {, the rest are the same.

I got this error:
TypeError: bean.readAccelerometer is not a function

installation of bean-sdk requires adjusted command as latest version of one dependency no longer works

bean-sdk has a number of dependencies. These depencies are automatically installed as sub-modules by npm. For all of these dependencies but one, the version is specified in package.json. This ensures that when installing bean-sdk, compatible versions of the dependencies are also installed.

For one dependency, commander, the version is not specified and npm will install the latest version. But somewhere after July 2020, a new version of commander was released that is no longer compatible with bean-sdk.

Therefore, you need to tell npm to use a specific version of commander when installing bean-sdk.
This can be done in the following way:

npm install -g --unsafe-perm [email protected] bean-sdk

The makers of bean-sdk can correct this in the npm package, but as the lightblue bean is no longer supported, I assume this will not happen.

bean read_device_info shows garbage after Sketch Name

Platform is Raspberry3:

$ bean read_device_info -a $A1

Found Bean with name/address: /987bf358352b
Connected!
Manufacturer: Punch Through Design
Model Number: Bean+
Hardware Version: 2A
Firmware Version: 201608170000 Img-B
Software Version: Software Revision
Battery Level: 60%
Sketch Name: test3-bean-comditeng

Command completed successfully

And you can see the real sketch name as the last in the list:

$ bean list_compiled_sketches

0: HID
1: accelRegisterWrite
2: getLed
3: getTemperature
4: setLed
5: test1
6: test2-reset_led
7: test3-bean-com

Command completed successfully

So there is extra diteng at the end of the name

hello

Hello,
I'm looking for an open source online dashboard, so that users can configure their beacon directly from their home, through their laptop.
And if you already have integration code for the iOS and android app, thank you

Supported Node Version

Hi,

according to your docs. Node 4.x.x is supported. But the following happens for me:

$ nodejs --version
v4.2.6
$ nodejs examples/set_led.js
examples/set_led.js:1
(function (exports, require, module, __filename, __dirname) { let lightblue = require('../src/lightblue')
                                                              ^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3

which looks like nodejs4 is not supported. At least for that example.

_disconnectDevices function error: is not a function

When invoke reset() function in LightBlueSDK class throws error:

this._disconnectDevices()
^
TypeError: this._disconnectDevices is not a function
at LightBlueSDK.reset (C:\projects\Juvs\LightBlue\node\node_modules\bean-sdk\src\lightblue.js:108:10)
at sdk.quitGracefully (C:\projects\Juvs\LightBlue\node\set_led.js:62:9)
at C:\projects\Juvs\LightBlue\node\node_modules\bean-sdk\src\lightblue.js:102:7
at C:\projects\Juvs\LightBlue\node\node_modules\async\dist\async.js:3838:9
at C:\projects\Juvs\LightBlue\node\node_modules\async\dist\async.js:421:16
at iteratorCallback (C:\projects\Juvs\LightBlue\node\node_modules\async\dist\async.js:998:13)
at C:\projects\Juvs\LightBlue\node\node_modules\async\dist\async.js:906:16
at C:\projects\Juvs\LightBlue\node\node_modules\async\dist\async.js:3835:13
at _peripheral.disconnect (C:\projects\Juvs\LightBlue\node\node_modules\bean-sdk\src\devices.js:190:9)
at Peripheral.<anonymous> (C:\projects\Juvs\LightBlue\node\node_modules\noble\lib\peripheral.js:53:7)
Connection attempt 1 to node process on 127.0.0.1:5858 failed. Will try again in 500.

Intalling bean-sdk on raspberry pi - november 2020

In order to install bean-sdk on a raspberry pi, a few adjustments are required to make it working in 2020. This is a tested and working recipe.

Tested on raspberry pi 4 and rasperry pi zero with 2020-08-20 raspios-buster-armhf (also tested with some older raspbian images)

sudo apt-get update && sudo-apt-get upgrade [this is probably not strictly neccessary]
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

close and re-open terminal window

npm install 6.17.1
npm install -g --unsafe-perm [email protected] bean-sdk
sudo apt-get install libcap2-bin
sudo setcap cap_net_raw+eip $(eval readlink -f which node)

try if it works with:

bean scan

Installing bean-sdk on a raspberry pi - november 2020

In order to install bean-sdk on a raspberry pi, a few adjustments are required to make it working in 2020. This is a tested and working recipe.

Tested on raspberry pi 4 and rasperry pi zero with 2020-08-20 raspios-buster-armhf (also tested with some older raspbian images)

sudo apt-get update && sudo-apt-get upgrade [this is probably not strictly neccessary]
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
npm install 6.17.1
npm install -g --unsafe-perm [email protected] bean-sdk
sudo apt-get install libcap2-bin
sudo setcap cap_net_raw+eip $(eval readlink -f which node)

try if it works with:

bean scan

rename does not work

Renaming either hangs or completes, but does not do the rename.

For example:

$ bean rename -a $A2 Bean1

Found Bean with name/address: /987bf3591c32
Connected!
Renaming Bean to: Bean1

Command completed successfully

Or hang and after waiting for few minutes control-c:

$ bean rename -a $A1 Shuckle1

Found Bean with name/address: Bean+/987bf358352b
Connected!
Renaming Bean to: Shuckle1

but after those tests names are still Blue+:

$ sudo blescan
Scanning for devices...
Device (new): 98:7b:f3:58:35:2b (public), -92 dBm
Flags: <06>
Tx Power: <04>
Incomplete 128b Services:
Complete Local Name: 'Bean+'
Device (new): 98:7b:f3:59:1c:32 (public), -58 dBm
Flags: <06>
Tx Power: <04>
Incomplete 128b Services:
Complete Local Name: 'Bean+'

I also restarted Bean+ devices several times, but that did not help.

bean read_device_info does not show Software version

With version 0.3.1:

$ bean read_device_info -a $A1

Found Bean with name/address: /987bf358352b
Connected!
Manufacturer: Punch Through Design
Model Number: Bean+
Hardware Version: 2A
Firmware Version: 201608170000 Img-B
Software Version: Software Revision
Battery Level: 60%
Sketch Name: test3-bean-comditeng

Command completed successfully

I would have expected to see 0.3.1 instead of "Software Revision" ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.