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

In general, a single MiOS Plugin is used to build multiple MiOS Devices. Each of these Devices will be independently configured, so would be attached to different IO-Channels (in your case, different IP Addresses). So the separation is fine for multiple IORelay boards, for example.

Code-wise, you can run as many of these as the underlying Vera will support. Given the API of the underlying Relay boards, my code has to poll the device on some frequency (configurable) to pickup the data. The more frequently you do this, the more Vera resources it will consume, so it’s always a balancing act.

There are some bug fixes in UI5 that make it a preferred deployment target over UI4. I run mine under UI4 at the moment but due to the afore-referenced bug, the higher sampling/poll rates really need UI5 for overall system reliability. Then again, I’ve chosen a 3-second poll rate, in part to “trigger” the UI4 problem, so you may not see it with lower poll frequencies… 8)

Thank you… Just what I was hoping to here. Polling delays should not be an issue.

And, thank you for the App. I have noted that most of the Apps are free. It would be better if you (and other developers) could get something for your efforts.

You’re welcome. I just develop stuff that I need to automate my house, and hope it’ll be useful to others to integrate their stuff also, or to use as code templates to create new things. It’s great to see people use it in interesting, and sometimes unusual, automation projects.

I’ve also made great contacts through the connections here, and I’m constantly learning new stuff from them, so it more than pays back.

hello

i have a relayboard ipx800 and your plugin is interresting

it works by ui5?
reads a variable in the status.xml?
op just send an order type http://192.168.xx/preset.htm?RLY4=1
to be off it is always 0 or 1 ep for orders suivan mode or pulse relay is led or followed rly number of channel
t could be applied vore plugin has this card

thank you

http://forum.micasaverde.com/index.php/topic my post, 9481.0.html

@davidd1205,
The boards from iorelay.com and the IPX800 are completely different. You’d need to re-write the logic, and build a new plugin, to handle the latter.

The current version in source control has the extensions to make it work, minimally, with UI5.

thanks but damage

In fact I would like a plugin or you choose the device you want to order (portal impilsion, light etc. …) and is assigned an order form "url with the fixed portion and peripheral portion of the peripheral control by button device (on off stop)
You have the time to make a plugin of this nature because I am unable
I do pourais test if you agree or if you know a developer first has to do this plugin to control the http interface

thank you in advance

@davidd1205,
I do not planon writing another relay control plugin at this time.

I am trying to install a IORelay ProXR Lite relay board but keep getting this error. Can’t seem to find a good guide for completing the install of the AP after it sets up the device. I am using the ethernet port on the relay board plugged into the same network as my Micasaverde lite.

Probably not much help, but this error usually indicates that there is something wrong in the LUA code. You can see what it is by sshing in to the Vera, going in to /var/log/cmh, running ‘tail -f ./LuaUPnP.log | grep “^5|^01”’ (minus the ') then clicking the reload button on the web interface. The error should show up in red text.

This might help give you an idea of where to look next.

The IORelay plugin that the MCV Team modified to put into apps.mios.com is dependant upon the [short lived] [tt]luupx[/tt] package. That doesn’t exist anymore, so it’s erroring out during startup with:

[tt]01 03/03/12 9:08:46.217 luup_log:83: IORelay: #83 starting up with id <0x2bd17680>
01 03/03/12 9:08:46.238 luup_require can’t find luupx <0x2bd17680>
01 03/03/12 9:08:46.239 LuaInterface::CallFunction_Startup-1 device 83 function relayStartup failed [string “…”]:238: attempt to call field ‘loadModule’ (a nil value) <0x2bd17680>
01 03/03/12 9:08:46.240 LuImplementation::StartLua running startup code for 83 I_IORelay1.xml failed <0x2bd17680>
[/tt]

Let me know what version of UI5 you’re on, as I can probably get it working but you’ll likely need the latest Beta since they have fixed Lua Library Loading there… I can make it work on older builds, but it will require you to SSH into your box to “undo” the .lua file compression that happens on earlier versions.

All this can be done without using the apps.mios.com version (using code.mios.com sources instead), but I’ll reach out to get ownership of my plugin in that repository so I can correct the problems.

Thanks for getting back to me. I am running 1.5.254

I can wait until the new version of U15 is ready. No need for you to try and support old code.

I will let you know how it turns out when I try it with the new release.

Hello guessed,

Not sure to be in the right topic, but I used with another domotic solution a Barionet 50 controller with ethernet web interface http://www.barix.com/Barionet_50/1351, and could send tcp command like setio,, (e.g. setio,1,999 will toggle relay 1) do you think it could be possible with your plugin? Thanks, chris

@chris66,
If you can connect to the device over TCP, and can get appropriate documentation on the commands it takes, then you could use the IORelay Plugin as a basis (aka “copy and edit”) for writing one that handles your Relay device.

The IORelay use Binary (“raw”) format, so you’d change that over to “crlf” if the format sends one command per line (or whatever)

Either way, it’s going to need a bunch of changes to handle the format differences between the API’s

@guessed

Looks like I have the same issue.

root@MiOS_41086:~# cd /var/log/cmh
root@MiOS_41086:/tmp/log/cmh# tail -f ./LuaUPnP.log | grep “^5|^01”
01 01/07/13 22:20:07.895 LuaInterface::CallFunction_Startup-2 device 18 function lug_startup failed (null) with return false <0x402>
01 01/07/13 22:20:07.898 LuImplementation::StartLua running startup code for 18 I_quadrelay1.xml failed <0x402>
01 01/07/13 22:20:07.904 luup_log:27: IORelay: #27 starting up with id <0x402>
01 01/07/13 22:20:07.909 luup_require can’t find luupx <0x402>
01 01/07/13 22:20:07.912 LuaInterface::CallFunction_Startup-1 device 27 function relayStartup failed [string “…”]:238: attempt to call field ‘loadModule’ (a nil value) <0x402>
01 01/07/13 22:20:07.913 LuImplementation::StartLua running startup code for 27 I_IORelay1.xml failed <0x402>
01 01/07/13 22:21:10.705 Mongoose XXX-mg_stop1 0x7bf350 1 2 <0x400>
01 01/07/13 22:21:12.721 Mongoose XXX-mg_stop2 0x7bf350 2 2 <0x400>
01 01/07/13 22:21:12.721 Mongoose XXX-mg_stop3 0x7bf350 2 2 <0x400>
01 01/07/13 22:21:12.722 Mongoose XXX-mg_stop4 0x7bf350 8268560 2 <0x400>
50 01/07/13 22:21:21.439 luup_log:0: L_sPhoneUI running version: 1.5.408 <0x402>

Looks like the version in apps.mios.com was “hand converted” to UI5, from my original sources, by Florin.

It’s broken.

I just validated the relay functionality using the original, unchanged, source code from code.mios.com:
http://code.mios.com/trac/mios_iorelay/browser/trunk

and it’s working correctly. It doesn’t have a Dashboard display for the parent device (it never did) but the children have the correct and work display. I tested it using a Roving Networks RN-XV board, so it should work with a direct USB connection also.

Thanks guessed.

Looks like I’m no longer getting the LUUP errors after manually loading the files you linked to. I’m only seeing the core device though with no inputs or outputs.

I have the PRO XR Lite on my LAN with a fixed IP but I’m not sure what port to append to the IP address.

Can you assist?

If anyone has this running under UI5 and can provide some tips on the process to get it working, that would be appreciated.

How specifically do you have the IORelay board attached to the Vera unit?

eg. IP, or Serial?

If it’s IP, then you need to specify a port, as it “defaults” to 2000 (the default for a Roving Networks RN-171 Wifi module)

In the Advanced dialog, you should almost exactly like the attached screenshot (take note on the Controlled via, parent_id being blank, and the device_file being “[tt]D_IORelay1.xml[/tt]”)

When you created the device, via the MiOS dialog, the ONLY thing you should have entered is [tt]D_IORelay1.xml[/tt], and perhaps a Description, and nothing else. It’s common for people to attempt to use the Serial Port as the Parent here, and that will break everything.

I just reloaded the files into my UI5 Vera, created a device, and it worked fine (over IP). For verification, my files are as follows in the [tt]/etc/cmh-ludl/[/tt] directory:

-rw-r--r-- 1 root root 315 Jan 27 15:23 S_IORelay1.xml.lzo -rw-r--r-- 1 root root 1302 Jan 27 15:23 L_IORelay1.lua.lzo -rw-r--r-- 1 root root 4748 Jan 27 15:23 I_IORelay1.xml.lzo -rw-r--r-- 1 root root 440 Jan 27 15:23 D_IORelay1.xml.lzo

These files should not be in any other directory (not even [tt]/etc/cmh-lu/[/tt])

Failing that, I’ll need a copy of the log file. This copy should be made just after restarting/reloading Vera so that it contains the error log lines relating to the problem.

Thank you for the info guessed.

Even though I’m a self confessed Geek, your knowledge of the Vera system seems far greater than mine so I’m not quite sure how you are adding the device and getting the trunk files there. I have this [url=http://www.controlanything.com/Relay/Device/R45PL_ZETH-ME&Category_Code=ETHERNET_PROXR_LITE&CpField=relays&CpValue=4]http://www.controlanything.com/Relay/Device/R45PL_ZETH-ME&Category_Code=ETHERNET_PROXR_LITE&CpField=relays&CpValue=4[/url] board and it is connected via a static IP.

I first added the device using the App store but got the LUA error on startup. I fixed this my manually uploading the files you provided on the trunk site by using the Develop Apps>Luup Files page but after both methods, I only see the parent device not any of the inputs/outputs.

Questions for you.

[ol][li]Can I use the Luup upload section in UI5 to get the trunk files there or do they have to manually be put into the directory you mention using something like WinSCP?[/li]
[li]Do the inputs and outputs only show up once Vera has actually connected to the device for the first time?[/li]
[li]Do you know the default port for the board I’m using?[/li]
[li]Does the mac address also have to be entered or is this self discovered?[/li][/ol]

Regards,

Pete

OK, haven’t worked with one of those before, but I’m sure we can work it out.

I first added the device using the App store but got the LUA error on startup.
Yes, the apps.mios.com version is something that Florin modified from my sources. It won't work, and you need to use the one from trunk (code.mios.com)
Can I use the Luup upload section in UI5 to get the trunk files there or do they have to manually be put into the directory you mention using something like WinSCP?
Either will work. If you manually upload using WinSCP, then you have to "compress" them afterwards using: [code] pluto-lzo c [/code]

This is internally what the file-upload thing is doing after the file is uploaded. The browser-based file upload will place the files into /etc/cmh-ludl/ for you. If you use WinSCP, then you’ll need to choose that as the target directory.

Do the inputs and outputs only show up once Vera has actually connected to the device for the first time?
I can't remember right now, but they're statically defined. They're not dependant upon the connection being viable to be able to display them, but I don't remember if I connect, then create, or if I create then connect.
Do you know the default port for the board I'm using?
Nope, but if you install the VCP onto a Windows machine, it connects to the device and you can use "netstat" (or similar) to work it out.
Does the mac address also have to be entered or is this self discovered?
Not needed. Vera will fill that in automatically when the device connects.