Coder Social home page Coder Social logo

org.openhab.binding.rflink's Introduction

RFLink binding for OpenHAB 2.0

Build Status

This repository contains a binding for OpenHAB 2.0 that deals with RFLink Gateway.

This binding is inspired by the Rfxcom binding

RFLink gateway supports RF 433 Mhz protocols like:

  • Cresta
  • La Crosse
  • OWL
  • Oregon
  • ...

The official supported devices list is available here : http://www.nemcon.nl/blog2/2015/07/devlist

Supported Things

RFLink binding currently supports following types of devices:

  • Energy
  • Lighting switch
  • Rain (to be tested)
  • RTS / Somfy blinds (Send)
  • Temperature (Receive)
  • Wind (to be tested)
  • X10 Switch (Send)
  • X10Secure Contact (Receive)

As the project is at its very beginning, the binding does not support many devices.

Discovery

A first version of discovery is supported, currently depending on the type of device a triggered brand/channel/button will appear in the inbox

Sending messages

Sending of triggers from openhab -> rflink -> device only works for a few devices.

Configuration

A manual configuration looks like

.things file

Bridge rflink:bridge:usb0 [ serialPort="COM19", baudRate=57600 ] {
    energy myEnergy [ deviceId="OregonCM119-0004" ]
}

most of the time on a raspberry

Bridge rflink:bridge:usb0 [ serialPort="/dev/ttyACM0", baudRate=57600 ] {
    energy myEnergy [ deviceId="OregonCM119-0004" ]
}

or

Bridge rflink:bridge:usb0 [ serialPort="/dev/ttyUSB0", baudRate=57600 ] {
    temperature myTemperature [ deviceId="OregonTemp-0123" ]
    switch      myContact     [ deviceId="X10Secure-12ab-00" ]
    rts         rts-123abc    [ deviceId="RTS-123abc" ]
    switch      x10-01001a-2  [ deviceId="X10-01001a-2" ]
}

All receiving devices must have the protocol as part of the device name (rts and x10).

.items file

Number myInstantPower "Instant Power [%d]"  <chart> (GroupA) {channel="rflink:energy:usb0:myEnergy:instantPower"}
Number myTotalPower   "Total Power [%d]"    <chart> (GroupA) {channel="rflink:energy:usb0:myEnergy:totalUsage"}
Number oregonTemp     "Oregon Temp [%.2f °C]"                {channel="rflink:temperature:usb0:myTemperature:temperature"}
Rollershutter myBlind "Blind [%s]"                           {channel="rflink:rts:usb0:rts-123abc:command"}
Switch myContact      "Contact [%s]"                         {channel="rflink:switch:usb0:myContact:contact"}
Switch mySwitch       "X10Switch [%s]"                       {channel="rflink:switch:usb0:x10-01001a-2:command"}

Supported Channels

Energy

Channel ID Item Type Description
instantPower Number Instant power consumption in Watts.
totalUsage Number Used energy in Watt hours.
instantAmp Number Instant current in Amperes.
totalAmpHours Number Used "energy" in ampere-hours.

Wind

Channel ID Item Type Description
windSpeed Number Wind speed in km per hour.
windDirection Number Wind direction in degrees.
averageWindSpeed Number Average wind speed in km per hour.
windGust Number Wind gust speed in km per hour.
windChill Number Wind temperature in celcius degrees.

Rain

Channel ID Item Type Description
rainTotal Number Total rain in millimeters.
rainRate Number Rain fall rate in millimeters per hour.

Temperature

Channel ID Item Type Description
temperature Number Temperature

Switch

Channel ID Item Type Description
command Switch Command
contact Contact Contact state

RTS / Somfy

Channel ID Item Type Description
rts Rollershutter Command

Dependencies

This binding depends on the following plugins

  • org.openhab.io.transport.serial

From the openHAB shell, just type

feature:install openhab-transport-serial

Or if you are developing your plugin with Eclipse IDE, select Run / Run Configurations... then select openHAB_Runtime click on the plug-ins tab, and check org.openhab.io.transport.serial in the target platform section.

The error message "Unresolved requirement: Import-Package: gnu.io" is a good indicator to know if you miss this dependency.

How to implement a new Thing

RFLink message are very simple ';' separated strings.

Packet structure - Received data from RF

Old format:

20;ID=9999;Name;LABEL=data;

New Format:

20;FF;Protocol;ID=9999;LABEL=data;
  • 20 => Node number 20 means from the RFLink Gateway to the master, 10 means from the master to the RFLink Gateway
  • ; => field separator
  • FF => packet sequence number
  • Protocol => Protocol
  • ID => ID to use in Things file
  • LABEL=data => contains the field type and data for that field, can be present multiple times per device

Examples

20;6A;UPM/Esic;ID=1002;WINSP=0041;WINDIR=5A;BAT=OK;
20;47;Cresta;ID=8001;WINDIR=0002;WINSP=0060;WINGS=0088;WINCHL=b0;
20;0B;Oregon Temp;ID=0710;TEMP=00a8;BAT=LOW;

The full protocol reference is available in this archive

How to get sample messages of your Thing

To get sample messages of your Thing, you can enable the DEBUG mode for this binding. Add this line to your org.ops4j.pax.logging.cfg (Linux?) file

log4j.logger.org.openhab.binding.rflink = DEBUG

or add this line to your logback_debug.xml (Windows?) file

<logger name="org.openhab.binding.rflink" level="DEBUG" />

Or you can use the Serial Monitor of your arduino IDE.

Or you can use the RFLinkLoader application. See how.

Add your code

  1. Add you thing description XML file in the ESH-INF/thing/ directory
  2. Implement your message in the org.openhab.binding.rflink.messages package
  3. Add the mapping of your new message in the static part of the RfLinkMessageFactory class
  4. Add your new channels names in the RfLinkBindingConstants class
  5. Add a ThingTypeUID constant (same class)
  6. Add this new constant in the SUPPORTED_DEVICE_THING_TYPES_UIDS list (same class)
  7. To test your thing, don't forget to add you thing in the .things and .items files. See configuration part of this document.
  8. Update this README.md document with the new thing and channels you implemented

How to package your binding

In Eclipse IDE, right click on the pom.xml file, then "Run As", and "Maven Install"

org.openhab.binding.rflink's People

Contributors

cyrilcc avatar johnjore avatar freynder avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.