rfr
An HTTP service to send RF signals over a 433Mhz transmitter for raspberry pi.
Prerequisites
My setup:
- Raspberry Pi 2
- 433Mhz transmitter - wired to GPIO 17 (physical pin 11)
- EDIMAX Wireless 802.11b/g/n nano USB adpater (EW-7811Un)
- Raspbian (Jessie)
- WiringPi
- Node 5.7.1
Installation
Please read all of this. Just running npm install
will tank hard.
Node
To get Node 5.7.x, I used their official tarball download: node-5.7.1 ARMv7.
I fetch this via wget
in a download folder, untar it, change to the new directory and then copy everything to /usr/local`.
WiringPi
With git already installed:
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
NPM Install
Now with all the prerequisites in place, you should be able to get a working install via npm
:
npm install
API
Each device can have multiple operations defined where an operation is comprised of a pulse
and code
.
{
"name": "myLamp",
"pulse": 178,
"operations": {
"on": {
"code": 1234567
},
"off": {
"code": 1234566
}
}
}
GET /api/device
List devices Returns a list of devices that will include their operations as well.
POST /api/device/:name
Add device Adds a new device definiiton.
GET /api/devices/:name
Get device info Returns configuration for device.
PATCH /api/device/:name
Update device Use JSON-PATCH specification to update the device.
DELETE /api/device/:name
Remove device Deletes a command from the device.
POST /api/device/:name/:command
Add device command Adds a new command to a device. A command only takes a code
property with the integer code to send.
PUT /api/device/:name/:command
Send command Sends the predefined command to the device.
PATCH /api/device/:name/:command
Updates a device command Use JSON-PATCH specification to update the command.
DELETE /api/device/:name/:command
Remove a device command Deletes a command from the device.