working with USB to serial adapters

I’m also looking at hooking up an FTDI based device. I will use the suggested cable from future. I have questons :

  1. Is this now (1.1.1245) plug and play or do i need to log in to the command line of vera ?

If command line is required , can someone give DETAILED instructions on how to get there and what to type. I know ZERO about linux and have no intention to learn anything about it (not interested) beyond what i need to do what i want with the vera box.

  1. is it guaranteed that a certain cable always comes up at the same node ? in other words if i have two cables … is the enumeration order fixed ? Meaning the first cable that was ever plugged in will always come up as /dev/usb/tty/0 and the second one as /dev/usb/tty/1.

What if i unplug the first one. will the second one still come up as /dev/usb/tty/1 ? For people that know windows : windows retains the assigned com port based on the usb serial number in the device. The cable will remain paired to the com port that was assigned on first plugin. I expect the same behavior on vera.

The reason i ask : i also have an external Aeon Z-Stick that now sits on /dev/usb/tty/0. i want to avoid the scneario where the usb cable may enumerate earlier and steal that node. this would render the vera inoperable to control z-wave devices… i want to avoid that…

  1. can anyone show me a line of luup code to set up the baudrate (9600,n,8,1) and send ‘hello world’ to /dev/tty/1 for example.
    That is all i need. i can take it from there.


Serial attached things are somewhat simpler than your thinking.

a) Plugin in the [Supported] USB-Serial Adapter
b) Goto MiOS developers -> Serial Port configuration and you’ll see it listed there (un-attached from any Device)

As an example, it’ll look like:

If you had a Plugin, and had instantiated a Device from it, then at this point you’d use the Used by device drop down to “attach” that serial port to your Device. You needn’t know whether it got attached to linux as /dev/tty/eieio or whatever as you never have to open it that way.

Similarly, in this dialog, you can setup the Serial Port parameters (Baud rate and such). This is done completely outside of your Plugin code.

“Data” from this Serial port is delivered to the Lua code in your Plugin’s [tt][/tt] block, in chunks, depending upon what you specify for [tt][/tt].

You can peruse the source code for a number of different plugins on [tt][/tt] that handle IO in this way, you can read through the Somfy walkthrough to get a general outline also (although it’s not well written at this point):

Oh, and to “write” stuff back, you use [tt]…)[/tt]. It might be easier to start with some of the rudimentary IO plugins (Panasonic TV, DirecTV, Monoprice Matrix) and then work your way up to one of the Alarm Panels or Power Measurement Plugins if you want to do something a little more complex.


i’m not interested in creating a ‘device’. too much work , too complex.
All i need is a way to send a simple string to a specific serial port. i don;t care about reading from the port. It’s outgoing only.

so , all i need is plug in the supported usb->serial cable , set up the params in the port configuration and use the command.
correct ?

My intention is to make a watchdog for Vera. I will make a timed ‘scene’ with a line of luup code that sends ‘ok’ to the serial port. that’s it. nothing else needs to be done.
on the other side there will be a microprocessor with some code. If vera does not behave nicely and does not send this ‘heartbeat’ signal regularly : powercycle.

Well, you could do that, but you’ll be fighting the problems you outlined above, notably “where’s my Serial Port”… since there are no guarantees about where this stuff gets mapped into [tt]/dev/[/tt] under Linux, esp as you plug more and more things in, add Hubs, etc, etc.

If you go that route, then you use regular old Lua IO commands, and open the [tt]/dev/ttxxx[/tt] device and do your thing, really limiting your use of the luup extensions to the [tt]luup.call_timer[/tt] stuff to make your function be called periodically for the heartbeat.

That said, I’d write it as a plugin. It’s really not that much code, esp if you start with something like the Weather Plugin (for periodically doing something), and then marry it’s code to something like one of the IR Devices (Panasonic, Onkyo, etc) for to see how IO is done.

It would be very small by the time you’re done, and re-usable.

Thank you Guessed for the clear explanation (second post).

If we have several serial ports through USB connections, does the UI in “MiOS developers -> Serial Port configuration” allow setting up each serial port ?

Yes, but only one Serial Port can be attached to any one Device… at any time.

But for example we can have at the same time a RS232 connection to an alarm panel + a RS232 connection to a Panasonic TV, using two USB ports (or one USB port + a USB hub) ?

Yes, the limit is per Luup Device, not per Vera.

I have a bunch of these hanging out the Back of Vera at any time, in Vera3 I had to switch to powered hubs, to overcome it’s under-supply of power to the USB ports, or to a real power supply (which is what I ended up doing).