npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

kaku-rpi

v2.2.0

Published

Node KlikAanKlikUit (KaKu) driver for Raspberry Pi

Downloads

14

Readme

kaku-rpi

Node.js driver for Raspberry Pi to control KlikAanKlikUit (KaKu) devices using a 433Mhz transmitter.

The required hardware setup for this module is documented here (we're only using the transmitter module). It consists of a simple, cheap 433Mhz transmitter (like this one) hooked up to the RaspPi's GPIO pins.

DISCLAIMER: this module is not in any way endorsed by, or related to, COCO International B.V. or Trust International B.V.

Attribution

The core of the code is based on original work from Randy Simons.

Big thanks to Job Wind for implementing the new style code.

Installation

First, make sure that you have a compiler and toolchain installed on your RaspPi.

Then, install the module:

$ npm i kaku-rpi

This will install the module, and its requirement (rpio). On limited hardware (like a Model A), installation may take a few minutes.

Usage

Note: the driver can address both old-style and new-style devices. How to talk to a device is determined by the ADDRESS argument for each command: if it's numerical, it's considered to address a new-style device. Otherwise, it's considered to address an old-style device.

const KlikAanKlikUit = require('kaku-rpi');

// Instanciate driver.
let kaku = KlikAanKlikUit([PIN, PERIODUSEC, REPEATS, PULSEWIDTH]);

// Switch a device on or off:
kaku.transmit(ADDRESS, DEVICE, STATE)

// Shortcuts:
kaku.on(ADDRESS, DEVICE)
kaku.off(ADDRESS, DEVICE)

// New-style only:
kaku.dim(ADDRESS, DEVICE, LEVEL) // dim a device
kaku.group(ADDRESS, STATE)       // turn a group on or off
kaku.groupOn(ADDRESS)            // turn a group on
kaku.groupOff(ADDRESS)           // turn a group off

Arguments:

  • PIN: the GPIO pin that the transmitter is hooked up to. This is the physical pin number, not the GPIO (mapped) number. Referring to the hardware page linked to above, it's using pin 11 (which is BCM GPIO pin number 17, but again, we're using the physical pin number, so 11).
  • PERIODUSEC: number of microseconds to sleep between high/low transitions (default: 375 for old-style, 260 for new-style).
  • REPEATS: number of times to repeat commands (default: 7 for both styles).
  • PULSEWIDTH: pulse width (default: 5, only used by new-style driver for now).
  • ADDRESS/DEVICE: KaKu works with addresses (A, B, C, … for old-style devices, and a number for new-style devices) and devices (1, 2, 3, …). An device is configured to listen on a particular ADDRESS/DEVICE pair.
  • STATE: whether to switch the device on (1/true) or off (0/false).
  • LEVEL: set dim level (0 = min, 15 = max).

NB: PERIODUSEC, REPEATS and PULSEWIDTH are different for old- and new-style. The respective drivers use sensible defaults, but if you set them they get used for both drivers, which basically makes the instance usable for only one type (old or new, but not both). In that case, if you want to control both types of devices, create an instance for each type.

New-style addressing

New-style devices are self-learning: you put them in learning mode, send an ON command from your remote, and the device will learn its address and device number.

To find out which address your remote is sending, you'll need a 433Mhz receiver, hardware to connect it to, and software to read the code. I've used this Arduino sketch (and the library that contains it) to find out the code my remote is sending.

Alternatively, you can also put your device in learning mode and send an ON command with this library, using any address code you like. Most devices can be paired with multiple remotes, so you can use both your regular remote and the Raspberry Pi simultaneously.