Vera plus Usb to TTL

Hi,

I do have a usb-to-ttl attached to my Vera, I can see the device being detected with dmesg but I was wondering how can I send / receive data from it in some luup code… is there anyway to achieve that ?

Well, it would help to know which device it actually is, whether it requires any drivers, and what protocol the device you’re wanting to control uses.

Hi @Tlex,

If the USB device is recognized by your Vera you should be able to see it if you go to Apps > Develop Apps > Serial Port configuration. You can set the correct parameters (baud rate, parity, bits) and link it to the plugin that will communicate with it (Used by device).

In the device implementation file you then define the LUA code that will handle the incoming data (an example is Vera-Dutch-Smartmeter/I_SmartMeter.xml at master · reneboer/Vera-Dutch-Smartmeter · GitHub)

With the luup.io.wite function you can send information. More details in the wiki Luup Lua extensions - MiOS

Note, as the device is linked to your plugin in the settings, you do not need to call the luup.io.open function. Use luup.io.is_connected in the incoming function and before write to make sure the connection is ready for data.

Have fun.

Cheers Rene

The serial device handling provided by Vera and the luup.io module is both difficult to use and seriously flawed. You might be better off using ser2net or suchlike to create a virtual IP port and then use TCP sockets to talk to your device.

This is assuming that your ‘TTL’ device is actually an RS-232 interface.

Hi AK,

It is indeed not perfect, but I have two plugins that produce quite a bit of data running using it reliably. I would indeed not use it for IP based traffic, but on the USB it is a quick way to get going.

Cheers Rene

They are in fact usb to rs232 and usb to rs485… I use them to talk with small devices I have closely located to my Vera.

It seams like they are not supported by the vera sadly :
CP210x UART Bridge

[ 3515.636000] Unsupported Device!
[ 3515.636000] Vendor=10c4 ProdID=ea60
[ 3515.636000] Manufacturer=Silicon Labs Product=CP2102 USB to UART Bridge Controller

I was hoping to regroup all these small equipments under the Vera… I guess I’m moving a step closer to a Pi with OpenLuup or something…

At this time, I have them connected to DT-06 TTL-to-Wifi but that’ s a lot of management :

Device → RS232-to-ttl → ttl-to-wifi → lua socket

Did some of you ever used the elfin-ew10 / elfin-ew11 (check on Amazon) ? they are pretty cheap.

True enough, but if starting from scratch, like the OP, I’d not try it!