trentrand / homebridge-rf-outlet

๐Ÿ”Œ Radio frequency power outlet accessory plugin for HomeBridge
4 stars 0 forks source link

how to get rf_on/rf_off values? #2

Open allenlicn opened 4 years ago

allenlicn commented 4 years ago

how to get rf_on/rf_off values in the config? assuming those values are what distinguish one rf outlet from another.

trentrand commented 4 years ago

Hey ๐Ÿ‘‹๐ŸปThis package has a dependency on rpi-433 for sending and receiving data over 433MHz radio frequency.

If you have setup a Raspberry Pi with a rf module, you can follow the example from rpi-433 to listen for commands. Then just press the on/off buttons on your remote to find the values for rf_on/rf_off respectively.

For example:

var rpi433 = require('rpi-433');
var rfSniffer = rpi433.sniffer({
  pin: 2, // Sniff on GPIO 2 (or Physical PIN 13), change to match your hardware
  debounceDelay: 500 // Wait 500ms before reading another code
}),

// Provide a callback, invoked when sniffer sees a RF transmission
rfSniffer.on('data', function (data) {
  console.log(`Code received: ${data.code}`);
});

Note that rpi-433 has an initial setup process that must be complete before the provided example will work: https://www.npmjs.com/package/rpi-433#usage

allenlicn commented 4 years ago

thanks for the explanation! will research the hardware requirements

trentrand commented 4 years ago

Here's a more complete tutorial if you're wanting to make this: https://github.com/trentrand/homekit-outlets