RF Switch


Supports basic 433MHz AM transmitter attached to a GPIO pin via 5v buffer. You may be able to get away with connecting the GPIO directly and running from 3.3v, but timing and performance won’t be as good.

Uses hardware timer to generate PWM output using interrupts.

Developed for use with i-Lumos lightswitches which use a 24-bit code. Timing parameters are programmable though so may work with other devices.

namespace IO::RFSwitch
class Controller : public IO::Controller
#include <Controller.h>

Controller for 433MHz transmitter.

Protocol is flexible but tested only with i-Lumos light switches. Written specifically for ESP8266 and uses the hardware timer to generate PWM signal via interrupts.

Public Functions

inline virtual const FlashString &classname() const override

Get the class name for this Controller.

virtual void handleEvent(IO::Request *request, Event event) override

Implementations override this method to process events as they pass through the stack.

class Device : public IO::Device
#include <Device.h>

Public Functions

virtual IO::Request *createRequest() override

Create a request object for this device.


Request* – Caller must destroy or submit the request

struct Config
#include <Device.h>
class Factory : public IO::Device::Factory
#include <Device.h>

Public Functions

inline virtual IO::Device *createDevice(IO::Controller &controller, const char *id) const override

Create a new device instance.

Called by DeviceManager::createDevice()

  • controller – The owning controller

  • id – Unique identifier for the device


Device* – The constructed instance

inline virtual const FlashString &controllerClass() const override

Return the expected controller type for this device class, e.g. ‘rs485’.

The Device Manager uses this value to verify that devices are constructed using the correct controller.

inline virtual const FlashString &deviceClass() const override

Return the Device class name, e.g. ‘r421a’.

class Request : public IO::Request
#include <Request.h>

Public Functions

virtual ErrorCode parseJson(JsonObjectConst json) override

Fill this request from a JSON description.

virtual void getJson(JsonObject json) const override

Get result of a completed request in JSON format.

inline virtual bool setNode(DevNode node) override

If nodes are supported, implemented this method.

struct Timing
#include <Device.h>

Protocol timings in microseconds.

Public Members

uint16_t starth

Width of start High pulse.

uint16_t startl

Width of start Low pulse.

uint16_t period

Bit period.

uint16_t bit0

Width of a ‘0’ high pulse.

uint16_t bit1

Width of a ‘1’ high pulse.

uint16_t gap

Gap after final bit before repeating.