https://github.com/codetheweb/rtlamr
A wrapper for rtlamr
https://github.com/codetheweb/rtlamr
Last synced: 29 days ago
JSON representation
A wrapper for rtlamr
- Host: GitHub
- URL: https://github.com/codetheweb/rtlamr
- Owner: codetheweb
- License: mit
- Created: 2018-04-15T02:10:26.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-13T16:10:49.000Z (over 6 years ago)
- Last Synced: 2025-03-07T05:04:24.731Z (about 2 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rtlamr-node
[](https://forthebadge.com)
[](https://forthebadge.com)A wrapper for [rtlamr](https://github.com/bemasher/rtlamr) in NodeJS. To use this, rtlamr must be in your $PATH.
## Installation
`npm install codetheweb/rtlamr-node`
## Usage
```javascript
const rtlamr = require('rtlamr-node');// Get single meter reading
rtlamr.single({id: xxxxxxxx}).then((data) => {
console.log(data);
});// Get stream of multiple meter readings
rtlamr.run({duration: 300}, (error, stream) => {
stream.on('data', (data) => {
console.log(data);
});stream.on('end', () => {
console.log('Finished!');
});
});
```**Make sure `rtl_tcp` is running when using `rtlamr-node`.**
`run()` takes the same arguments as the original `rtlamr`. For example, to connect to a remote RTL_TCP server, you would pass in `{'server': '192.168.0.xxx:zzzz'}` as an argument.
`single()` takes an object with two properties, `id` and `timeout`. `timeout` is in seconds and is optional.