Plugin for Relay Output / Analog Input Boards from iorelay.com

I’ve been working on some Monitoring and Management for my Garage, and wrote a plugin to handle Relay-based IO Boards from IORelay.com (National Control Devices)

It’s now working for manual control/monitoring, so I’m publishing what I have so far:
[url=http://code.mios.com/trac/mios_iorelay]http://code.mios.com/trac/mios_iorelay[/url]

So far, it handles the ProXR, ProXR Lite and Reactor Relay boards from NCD. Specifically models that support 1-8 Relays, and 8 Analog Inputs. These boards each have Flexable Serial Interfaces, offering direct-USB, ZigBee ZB, 802.15.4, Ethernet and basically anything “Serial” that uses the Xbee-style pinout.

The Plugin will

[ul][li]expose each configured Relay as a Light Switch, with regular On / Off controls[/li]
[li]expose each configured Analog Input as a Light Sensor, with values from 0-100%[/li]
[li]poll the Inputs on a configurable frequency (seconds) for changes in value[/li]
[li]poll the Relays, for any changes in status that occur “outside” of Vera (such as the Reactor Relays which run autonomously)[/li]
[li]throw out “lost” messages when they’re not acknowledged within a reasonable timeframe[/li]
[li]allow manual (permanent, temporary or lockout) override for Reactor Relays, which are normally controlled by the Processor on the Reactor Relay.[/li][/ul]

I haven’t tested it against Scenes yet, but it should work fine using standard [tt]LightSensor1[/tt] and [tt]BinarySwitch1[/tt] based scenes (for control and events)

In my configuration, I’ve been testing with the following boards:

[ul][li]2 Relay, 8 Analog input ProXR Lite
This is for my Garage, and is using a Roving Networks RN-XV for Wifi-based control.
It has inputs representing Light Level, Temperature and a few Reed Switches, the outputs will be used for Control.[/li]
[li]2 Relay, 8 Analog input Reactor Relay
This is to eventually auto-restart Vera if it doesn’t heartbeat, and uses a USB adapter for control (it hangs just below Vera).
One Relay will Control power to Vera, and will eventually cut-it-off if it doesn’t receive a [MiOS Scene-based] Heatbeat within 10-15 minutes. This will be more fully implemented once I do the Garage stuff.[.li][/ul]

oops, realized I hadn’t set the code.mios.com wiki perms correctly for public users. Fixed now.

Attached are some pictures from the assembled Garage device, just before I swapped out the original 802.15.4 SF Communications modules for the RN-XV Wifi boards.

The pics are a bit grainy, but you can see the wiring for the 2x Relay Outputs, and some of the Inputs, are externalized. Internally I have a Temperature sensor hooked up, and externally I have a Light sensor and 2x Seco-Larm “wide-gap” reed switches to detect the Garage door position.

Patched to 0.1.1 for stability.

There were some cases where the [tt]poll()[/tt] loop would simply stop working. Changed code from [tt]luup.call_timer[/tt] to [tt]luup.call_delay[/tt], and ran a 24-hr burn in to ensure the Relays and Inputs stayed in sync.

Mostly putting info here for folks that may be doing things with high-frequency timers, combined with high-frequency IO. In this situation, you may be better off using [tt]luup.call_delay[/tt].

To begin with: Thank you! This is the perfect plugin/toy for engineers like me… 8)

Do you think you could also provide a explanation of how to integrate the board with the wireless option? On the following page I only found one for the usb one, and it looks like some pictures are missing: [url=http://code.mios.com/trac/mios_iorelay/wiki/Installation-UI4]http://code.mios.com/trac/mios_iorelay/wiki/Installation-UI4[/url]

How is the RN-XV configured? Somehow I need to tell it which wlan it has to join?

Do you think the following board would work with the RN-XV to?
[url=http://www.controlanything.com/Relay/Device/ZR220HP]http://www.controlanything.com/Relay/Device/ZR220HP[/url]

@chixxi,
I can add that description, it might just take a little while to get to it. Generally speaking though, I plugged the RN-XV module into a XBee explorer that I had from Sparkfun (http://www.sparkfun.com/products/8687) and then connected to it using a Terminal program (“screen” on my Mac) with it’s initial Baud rate settings.

The commands are available in this doc:
http://www.rovingnetworks.com/files/resources/WiFly-RN-UM.pdf

you need to set the Wifi Parameters, so that it’ll connect to your Network (etc), as well as the Baud Rate, so that it’ll connect [correctly] to the IORelay board.

After I got the basics working, I turned off all the response strings (using “[tt]set comm[/tt]”) so it wouldn’t put excess characters out to the IORelay board.

Don’t forget to “save” the changes after you make them, since most are transient otherwise.

To my knowledge, all of the IORelay.com/ControlAnything.com boards use the same API/Command structure, so as long as it has the XBee “footprint” you should be able to use it. The plugin has a parameter for the # of inputs, which you’d need to set to “0” for that board, as well as a parameter for the # of outputs, which you’d set to “2”.

For the boards I was using there’s a “3rd rail” of connector just inside one of the XBee rails. This is fine for an XBee module, since the clearances below it are larger, but it interferes with an RN-XV module. I put an extra set of headers onto my RN-XV before installing it so that I could “raise it up”… the details for that are in the install instructions.

Some of the Relay-only boards don’t have this extra row, but if you’re ordering it, you may as well pay for the headers up front (note that these are non-standard pitch, so order the right ones)

Now, I’ve run into an occasional problem where mine seems to disappear off the network. I haven’t chased it down yet, but think it’s because I’ve mounted it in a distant corner of my garage. If I were doing it again, I’d custom-order (direct from RovingNetworks.com) the RN-XV that has the u.FL (RN-XV-U) or SMA (RN-XV-S) connector so that I could use an external antenna, since I think I have an antenna/range problem with the built-in antenna (RN-XV-W)

You’ll see both those options in the “buy” tab on this page:
http://www.rovingnetworks.com/products/RN_XV

Good day!

I’ve got a very basic relay from IORelay.com and tried to set it up using your steps. I just got my vera a few days ago so this was more to try adding a custom device than to actually use the relay (for now). I can add the relay no problem, but there’s no options on the main screen. All I see is the relay in the devices list, with no ON/OFF button or anything. The images aren’t available anymore in the post, so maybe I’m missing some step.

Could you help me out please ?

Thanks !
Eric.

ok, so what Model and IO Device are you using in your setup?

My primary one is Ethernet attached, and the settings dialog is per the attached images (for some reason, my images from the Wiki have vaporized)

For a USB (direct) attached one, it’s a little simpler, except you need to go into the Serial Port configuration and “associate” the Serial port adapter with the IORelay board.

Can you push a screenshot of what you’re seeing? The “Parent” device really has no dashboard, it’s empty. But you should have 2 “Relay” child devices (represented as Light Switches) that you can use to control the Relays on the board.

oh, and I have my Interval set very aggressively, in order to cause a certain MiOS bug to occur. I don’t recommend setting it down that low.

Thanks so much for your response @guessed! I am going to get some boards for Christmas :wink:

Recommend you start with 1 board and get it working well, preferably with wired USB.

It’s still in prototype stage and it does break, right now I think it’s due to an interaction between the Wifi XVee and Vera but I haven’t isolated it yet. Also, the more inputs and outputs you have the more error probe right now due to the amount of polling I have to do.

Concratulations to your 2000th post! :o

Yeah I’m gonna do that, even though it’s going to be difficult for me to order “just one simple board”.

dear guessed, may I kindly ask you to have a look at the following post from me, no hurry, just if you want to…
http://forum.micasaverde.com/index.php/topic,8440.0.html

have a nice weekend everybody!

[quote=“guessed, post:10, topic:169025”]Recommend you start with 1 board and get it working well, preferably with wired USB.

It’s still in prototype stage and it does break, right now I think it’s due to an interaction between the Wifi XVee and Vera but I haven’t isolated it yet. Also, the more inputs and outputs you have the more error probe right now due to the amount of polling I have to do.[/quote]
Im thinking of buying a wired USB relay board with 2 relay contacts and 8 A/D inputs.
But how serious is this polling issue?
Because im thinking of using this to view my alarm status and maybe in the future to set the alarm.
To view the status of my alarm i use analogue outputs (dry contact) so that i can program a scene in case of break in, fire or sabotage…

I haven’t yet narrowed down why the WiFi board “just stops” during the polling cycles. I suspect that there’s something else going on with my Network that periodically causes the WiFi board to “drop out”. I’ve seen this type of thing before where Vera’s HTTP-based “Discovery” techniques (for Video Cameras, GC100’s etc) interfere with the Roving Networks WiFi chips (which also expose a HTTP interface)

I haven’t tried a long run of it over direct-USB, so I don’t know if the same types of problems are exhibited under that.

I currently poll every 3s, with 8 inputs and 2 outputs being sampled (which is very aggressive). I sample the outputs as I may not be the only thing making changes (eg. a Reactor-Relay board). I have verbose logging enabled (permanently) so, as you can imagine, I have a bunch of logging output flying by at any moment.

Given your description though, I’m a little puzzled. If you have an Alarm system, why do you need this board with a few extra Zones? If you don’t have an Alarm system, then I’d certainly get one of those over one of these boards, since it’s not intended to be an Alarm system, more of an input monitoring system (which is what I have it wired up for, “Is my Garage open” type stuff)

I got a honeywell Galaxy G2-44 alarm panel and this type of panel doesn’t have a rs232 connection. And the cheapest option to get a rs232 programming cable is spending about 60euro for just the cable and then its stil the question if i can set the system with it.

But I can program outputs of the panel to close/open on certain moments, like the alarm is set etc.
So im planning to use such output as your “the garage door is open” :wink:

But the board also has 2 relays which i could connect to the inputs of the alarm panel so that i could use it like a trigger for alarm (dis)arm

The IOrelay doesn’t have to be a USB version, Ethernet is also a option for me if thats is better supported?
(WLAN is not necessary because router/ vera and alarm panel are all within 0.5 meters :wink: )

Ah, ok. Your Alarm has PGM’s, fair enough.

I’d alway’s use Wired over Wireless, whenever you have a choice. The USB Version will be fine. I have one of these, it’s just on the Second Relay board that I have, and I just haven’t gotten around to using it yet.

My second board happens to be a Reactor-Relay, that’ll be connected directly to Vera over USB, so I had been setting up the code to handle either… hence the Polls on the Relay outputs, since it runs under it’s own steam (and was intended to Reboot Vera if it didn’t heartbeat in a certain timeframe, but other projects took over)

Hi,
Is it possible to use this contact closure input http://www.controlanything.com/Relay/Device/ZSCAN16PROXR_USB with the pluggin ? I would like to monitor different input to trigger scene!

thanks

Not at this time. Per the intro page it has an 8input, 8output limit.

Do you see any issues with using a ‘wired’ ethernet connection vs WiFi? This makes it easier for my setup and I could save a couple of bucks.

The wired options (Ethernet, Serial, USB) will probably work more reliably (like anything wired). I used WiFi as it was going to be hard to pull Cat5 into the corner of the garage from the nearest hookup.

You’ve reminded me that I have a little work to do on the plugin to make it’s channel-data reads (input handling) a little more reliable, since mine is WiFi and “at the edge” of my Wifi setup’s reach…

Thanks for getting back to me.

Could I use the plug in for more than one relay board? I need one in the garage and one in the furnace room to control the dampers. I am using X10 now but want to incorporate it into this system.