rfZone is an erlang application that acts as a trigger multiplexor. I.e. it can receive input triggers from various sources and, according to it's configuration, create wanted output triggers.
The internal format used is CANopen.
To build rfZone you will need a working installation of Erlang R15B (or
later).
Information on building and installing Erlang/OTP
can be found here
(more info).
rfZone is built using rebar that can be found here, with building instructions here. rebar's dynamic configuration mechanism, described here, is used so the environment variable REBAR_DEPS
should be set to the directory where your erlang applications are located.
rfZone also requires the following erlang applications to be installed:
- uart - https://github.com/tonyrog/uart
- can - https://github.com/tonyrog/can
- canopen - https://github.com/tonyrog/canopen
To use rfZone for hardware io handling you need the computer to have accessible io-pins, for ex a Raspberry Pi, possibly equipped with a PiFace interface board.
You also need the following erlang applications to be installed (and running):
- gpio - https://github.com/Feuerlabs/gpio
- spi - https://github.com/tonyrog/spi (optional)
- piface - https://github.com/tonyrog/piface (optional)
To use rfZone for sms, as input triggers or as output, you need a modem.
You also need the following erlang application to be installed (and running):
If you want rfZone to send email as output, you need the following erlang application to be installed (and running):
- gen_smtp - https://github.com/Vagabond/gen_smtp
Input triggers can also be used to call any erlang function using apply. You must of course then have the relevant applications installed (and running).
Available is also the possibilty to connect to the exosense service supplied by Feuerlabs.
Contact them for details on how to do this.
To use rfZone for remote control handling from an iPhone/iPad app you need:
- A tellstick usb pin, see www.telldus.com.
- An iPhone/iPod/iPad with the Seazone RC app, available at App Store.
rfZone currently has support for the following remote control protocols:
- nexa
- nexax
- waveman
- sartano
- ikea
- risingsun
For information on what protocol a specific brand uses see Protocol - Brand Map.
To use the tellstick usb pin you need the correct driver installed. So far it has been an FTDI driver that can be found at www.ftdichip.com, to be sure it might be advisable to check on www.telldus.com.
Clone the repository in a suitable location:
$ git clone git://github.com/malotte/rfzone.git
rfZone and SeaZone RC are communicating using CANOpen over UDP. This means they are addressed by CANOpen node ids. See www.canopensolutions.com for a description of CANOpen.
In this case the SeaZone RC app is broadcasting messages that are handled by canopen/rfZone after which a reply is sent. For this to work rfZone must be configured to know that the broadcasted messages should be handled by it.
In the SeaZone RC app you can configure the "RemoteId". According to the standard node ids can either be short(11 bits) or extended(27 bits). The SeaZone RC app is configured to use extended node ids.
This id should then be included in the rfZone configuration file described below.
In the SeaZone app you must define devices corresponding to the real devices you want to control. Devices can be grouped and also added to panels to get a better overview. The device channel given to a device must correspond to the remote channel configured in rfzone.conf.
Arguments to all applicable erlang applications are specified in an erlang configuration file.
An example can be found in "sys.config".
rfzone uses a config file where the devices to control are specified, the syntax is explained in the file. A description is also available in User's Guide - How to configure rfZone.
The device for the tellstick usb pin is also specified in this file.
Default file is "rfzone/priv/rfzone.conf".
Either update this file or create a new at any location and specify that in sys.config.
Rebar will compile all needed dependencies.
Compile:
$ cd rfzone
$ rebar compile
...
==> rfzone (compile)
There is a quick way to run the application for testing:
$ erl -config sys -pa <path>/rfzone/ebin
>rfzone:start().
(Instead of specifing the path to the ebin directory you can set the environment variable `ERL_LIBS.)
It is possible to change configuration file using:
>rfzone_srv:reload(<File>).
Stop:
>halt().
To generate a proper release follow the instructions in Release Handling or look in the Rebar tutorial.
Before the last step you have to update the file "rfzone/rel/files/sys.config" with your own settings. You probably also have to update "rfzone/rel/reltool.config" with the correct path to your application (normally "{lib_dirs, ["../.."]}") and all apps you need.
{app, sasl, [{incl_cond, include}]},
{app, stdlib, [{incl_cond, include}]},
{app, kernel, [{incl_cond, include}]},
{app, uart, [{incl_cond, include}]},
{app, can, [{incl_cond, include}]},
{app, canopen, [{incl_cond, include}]},
{app, rfzone, [{incl_cond, include}]}
And then you run:
$ rebar generate
.
When generating a new release the old has to be (re)moved.
Start node:
$ cd rel
$ rfzone/bin/rfzone start
(If you want to have access to the erlang node use
console
instead of
start
.)
rfzone is documented using edoc. To generate the documentation do:
$ cd rfzone
$ rebar doc
The result is a collection of html-documents under rfzone/doc
.