Code Monkey home page Code Monkey logo

bt-presence's People

Contributors

cmvee avatar fossabot avatar sbernhard avatar

Stargazers

 avatar  avatar

Watchers

 avatar

bt-presence's Issues

bt-presence needs 2 pings

It seems that l2ping on my Linux system fails for the first ping but succeeds after that. As a test, I was scanning for my phone. I had to adjust the bt-presence index.js to send 2 pings.

$ sudo l2ping -c 3 -t 5 B0:C5:59:9C:9C:EE
Ping: B0:C5:59:9C:9C:EE from A4:34:D9:5A:45:77 (data size 44) ...
no response from B0:C5:59:9C:9C:EE: id 0
0 bytes from B0:C5:59:9C:9C:EE id 1 time 784.26ms
0 bytes from B0:C5:59:9C:9C:EE id 2 time 19.07ms
3 sent, 2 received, 33% loss

Any or All

It'd be nice if you could set the type of combination you want to check for presence when there are several addresses. As far as I could test, if you use several comma separated addresses, true is return when ALL are present, false otherwise. I'd like the node to return true if ANY is present. Maybe you could add a new setting to set ANY or ALL, or maybe some type of notation for the Devices setting, like "(mac1 || mac2) && mac3"...

Building with Strict True error

When a npm run build is called with "strict": true in tsconfig.json the following error is generated;

src/index.ts:33:13 - error TS2564: Property 'timer' has no initializer and is not definitely assigned in the constructor.

33     private timer: NodeJS.Timer;
               ~~~~~


npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-11-26T18_45_47_603Z-debug.log
# npm -v
6.4.1
# node -v
v8.12.0

Clearing to false build module.

bind

In case I'm stopping and starting btPresence again, I get:

TypeError: Cannot read property 'bind' of undefined

2|node-red | 18 Dec 23:23:52 - [error] [bt-presence:41b0680f.ecda98] TypeError: Cannot read property 'bind' of undefined
2|node-red | at btPresence.start (/home/pi/nodes/node_modules/bt-presence/index.js:130:37)

get presence/not-present for each device

It would be nice to be able to get separate events (present/not-present) for each device in the list. It is certainly easy for a developer to put in logic to manage devices in groups, so that doesn't seem really necessary (though I understand the use-case).

But without separate events per device there is really no way to implement presence for multiple entities...

Always emit result

Instead of only emitting the result on a change, could you offer a setting that enabled the result to be emitted every time please?

bt-presence/src/index.ts

Lines 248 to 263 in 28a3ace

if (result.isPresent){
this.btDevicesPresent = _.uniq(_.concat(this.btDevicesPresent, result.address));
} else {
this.btDevicesPresent = _.pull(this.btDevicesPresent, result.address);
}
// detect changes in presence and emit events if necessary
if (this.btDevicesPresent.length > 0){
if (!devicesPresentAtLastCheck || this.reportFirstResult){
this.emit('present', result.address);
}
} else {
if (devicesPresentAtLastCheck || this.reportFirstResult){
this.emit('not-present', result.address);
}
}

setcap privileges to run l2ping

You might want to add some documentation to the README.md that l2ping needs to run as root.
Grant root privileges to run the l2ping scan by issuing this command:
$ sudo setcap 'cap_net_raw+eip' `which l2ping`

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.