# rpi-433

> Simple NodeJS module to send and receive decimal codes through 433Mhz device on RaspberryPI 2

Latest version **2.1.0** (published 2016-05-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install rpi-433
pnpm add rpi-433
yarn add rpi-433
bun add rpi-433
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2016-05-16 |
| First published | 2015-07-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 46 |
| Author | eroak |
| Maintainers | eroak |
| Keywords | raspberry, rasp, raspi, domotic, 433mhz, sniffer, sniff, send, receive, nodejs, outlets, radio, code, wiringpi, rc, gpio |

## Links

- npm: https://www.npmjs.com/package/rpi-433
- Repository: https://github.com/eroak/rpi-433
- Homepage: https://github.com/eroak/rpi-433#readme
- Issues: https://github.com/eroak/rpi-433/issues
- npm.io page: https://npm.io/package/rpi-433

## Dependencies (2)

- [q](https://npm.io/package/q.md) ^1.4.1
- [underscore](https://npm.io/package/underscore.md) ^1.8.3

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads
- [datasets-fi-postalcodes](https://npm.io/package/datasets-fi-postalcodes.md) — 1.1K weekly downloads

## Recent versions

- 2.1.0 (latest) — 2016-05-16
- 2.0.0 — 2016-05-15
- 1.2.1 — 2016-05-08
- 1.2.0 — 2016-05-08
- 1.1.4 — 2016-05-08
- 1.1.3 — 2016-05-08
- 1.1.2 — 2016-05-08
- 1.1.1 — 2015-10-19
- 1.1.0 — 2015-10-19
- 1.0.19 — 2015-07-23
- 1.0.18 — 2015-07-23
- 1.0.17 — 2015-07-23
- 1.0.16 — 2015-07-23
- 1.0.15 — 2015-07-23
- 1.0.14 — 2015-07-23
- … 14 more at https://npm.io/package/rpi-433/versions

## README

# rpi-433
[![npm version](https://badge.fury.io/js/rpi-433.svg)](http://badge.fury.io/js/rpi-433)

[![NPM](https://nodei.co/npm/rpi-433.png?downloads=true)](https://nodei.co/npm/rpi-433/)

Simple NodeJS module to send and receive decimal codes through 433Mhz device on RaspberryPI 2

### Dependencies
* wiringPi : https://projects.drogon.net/raspberry-pi/wiringpi/

### Building WiringPi
```bash
pi@raspberrypi ~ $ git clone git://git.drogon.net/wiringPi
...
pi@raspberrypi ~ $ cd wiringPi/wiringPi
pi@raspberrypi ~/wiringPi/wiringPi $ sudo su
...
root@raspberrypi:/home/pi/wiringPi/wiringPi# ./build
```

### Installation

```bash
npm install rpi-433
```

### Usage
Firstly, make sure you are running your application as root or with sudo, else the Raspberry Pi will not let you output/input to the GPIO and you'll get an error.
```bash
sudo node myscript.js
```

Please note that there are different and confusing ways to reference a channel. This module supports wPi schema. Once wiringPi is installed, in your CLI you can run `gpio readall` and check the wPi column or consult https://projects.drogon.net/raspberry-pi/wiringpi/pins/

```bash
gpio readall
```


### Example

```js
var rpi433    = require('rpi-433'),
    rfSniffer = rpi433.sniffer({
      pin: 2,                     //Snif on GPIO 2 (or Physical PIN 13)
      debounceDelay: 500          //Wait 500ms before reading another code
    }),
    rfEmitter = rpi433.emitter({
      pin: 0,                     //Send through GPIO 0 (or Physical PIN 11)
      pulseLength: 350            //Send the code with a 350 pulse length
    });

// Receive (data is like {code: xxx, pulseLength: xxx})
rfSniffer.on('data', function (data) {
  console.log('Code received: '+data.code+' pulse length : '+data.pulseLength);
});

// Send
rfEmitter.sendCode(1234, function(error, stdout) {   //Send 1234
  if(!error) console.log(stdout); //Should display 1234
});

/* Or :

rfEmitter.sendCode(code);
rfEmitter.sendCode(code, {  //You can overwrite defaults options previously set (only for this sent)
  pin: 2,
  pulseLength: 350
});
rfEmitter.sendCode(code, callback);
rfEmitter.sendCode(code, {
  pin: 2,
  pulseLength: 350
}, callback);
*/

//rpi-433 uses the kriskowal's implementation of Promises so,
//if you prefer Promises, you can also use this syntax :
rfEmitter.sendCode(1234, {pin: 0})
  .then(function(stdout) {
    console.log('Code sent: ', stdout);
  }, function(error) {
    console.log('Code was not sent, reason: ', error);
  });
```

---
_Source: https://npm.io/package/rpi-433 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
