Serial port:

I was going to move the last pieces of my HC system from HomeSeer to Vera. That involved moving some RS232 devices from the PC to Vera.

One of the devices is a shade controller for Somfy motors: http://www.blindshademotors.com/documents/accessories-special-applications/rs232-to-rts-compatability.pdf

This controller receives commands via the serial port - much the same as a IR transmitter.

On http://wiki.micasaverde.com/index.php/LuaUPnP I read that it should be possible to add a new device through the web interface of Vera. I could not find the option to add a LuaUPnP device.

Has anyone else succeeded in adding a serial port device?
Are you able to add a device through a USB–>Serial converter that has 8 ports? (that is the one I am currently using as I have a couple of RS232 devices Vera will need to control)

It is claimed that this can be done once the Lua is available

Does someone know when Lua is expected to be available?

Last week we released and alpha version of the backbone ( you can control devices/scenes using upnp ), next week we should have an alpha version of the web interface too.

Vera has two onboard serial ports, but you need to solder the pins to the board. The first serial port is for kernel output on boot, the second can be configured to control other devices. But easier it will be to use a USB-to-serial convert ( ftdi / pl2303 / cp210x cip )

It will be an web page on Devices Tab, where you’ll be able to add your device on the LuaUPnP version of the firmware.

[quote=“nanckekr, post:1, topic:164506”]Has anyone else succeeded in adding a serial port device?
Are you able to add a device through a USB–>Serial converter that has 8 ports? (that is the one I am currently using as I have a couple of RS232 devices Vera will need to control)[/quote]
I’m not sure, I don’t have such device, but if you have a kernel module for it and if it creates virtual serial devices it should work (teorethically).

How many USB-to-serial adapters can be connected to Vera with USB hub?

there’s no limit.

I could use some help getting started with connecting a RS232 controlled piece of hardware to Vera.

I updated to firmware 733 and accepted “reset to factory”
After upgrade & restart I configured the rooms again, and then added rooms to the devices

I noticed a device now that I do not recall having added before: “Remote Control”. I do not know what that device does. It has no cogwheel next to it. It is possible this is something that I did add months ago, but I do not recall having done that and I do not know what it does.

On the physical side I connected my Somfy motorized shade RS232 controlled transmitter. This is done through a USB to RS232 adapter that has 8 serial outputs: http://www.usbgear.com/computer_cable_details.cfm?sku=8XDB9-USB&cats=199&catid=199%2C478%2C474

I then looked at the predefined serial scripts under Devices–>Luup plugins–>I_TestSerial.xml. In this XML file I found no baud rate settings etc.

I then looked at the configuration file (based on the wiki documentation) http://192.168.0.6:49451/data_request?id=user_data&output_format=xml and did not find any specifications there either.

I would like to address & test this in smaller steps
Step 1: How do I know if the USB–>Serial adapter is recognized by Vera
Step 2: How do I configure in Vera which of the 8 ports I want to address
Step 3: How do I test sending 3 specific characters to the serial port:
Step 4: How do I configure a piece of Luup code to be executed when a byte is received on the serial port? (this step is not required for the Somfy control, but two other serial devices that Vera must control - a Sony receiver and a Panasonic projector)

Somfy RS232 specification

Up: “!02U” (case sensitive, replace “02” with channel number)
Down: “!02D” (case sensitive, replace “02” with channel number)
Stop: “!02S” (case sensitive, replace “02” with channel number)

9600, 8 data bits, 1 stop bit, No parity

I believe the Remote Control you are seeing is the Vera Dongle. I noticed that when I upgraded to .733 also.

Nanckekr,

The UC232R-10 from http://www.futureelectronics.com/en/Pages/index.aspx is known to work with the Linux kernel in Vera. If using your own usb->serial, go to:

cd /dev/usb/tts

ls

ls is the Linux equivalent of dir. You should see the Z-Wave dongle as ‘0’. Remove it, and it goes away. Insert your USB->serial, and if another file appears there, then your dongle is supported.

Would you be able to add to this thread the protocol you want to implement? Start with a basic one. And I’ll do a step-by-step sample and document it in the wiki, and give you the file so you have something to start with.

Aaron

Aaron

I could not ask for better help - thanks!

Its been a while since I have logged into my Vera here in San Francisco, and it appears I have lost my SSH password. Do you know how to reset it, or must I simply reset Vera entirely and add my devices again? If so, how do I reset Vera so deeply that SSH is enabled again?

In the meantime, I’ll describe the protocol, and provide two examples - one for the Somfy shade controller (first and most important issue) and secondly for the Panasonic projector. The projector is more interesting as it is a two way communication.

  • Anders

Seems like I found solution to the SSH/password. The problem was that somehow it must have been reset. For other readers, here is how to set the SSH password:

  1. goto your Vera page
  2. Select Advanced–>Net& WiFi–>Advanced Configuration
  3. You are now asked to create a SSH password if one is not already set
  4. You are now able to login using putty with username “root” and the newly created password.

Back to the USB/Serial support…
I tested the steps you provided, and I was able to see the “0” file, then disappear and reappear when I inserted the dongle again.

Know knowing I was in the right folder I added/removed/added the USB–>8 port serial adapter I have. It did not make any changes to the file system. I tried with the dongle mounted and without and in both ports.

I am thus assuming that the adapter is not initially supported. That is a shame as I need a great deal of serial ports. At this point I see two options:
A) Order and wait for delivery of a couple of UC232R-10 and connected them through a USB hub
B) Try and get a Linux driver installed for my existing USB–>8 port serial working.

I found a link to the driver here:
http://www.ftdichip.com/FTDrivers.htm
The first question is if I need a VCP or V2XX driver??

The Linux driver for VCP is here: http://www.ftdichip.com/Drivers/VCP.htm
The Linux driver for V2XX is here: http://www.ftdichip.com/Drivers/D2XX.htm (here I need to know the Linux version)

Are you able to guide me in this? I would like to know which type to install and how and where to do it. After install I assume the router need to reboot and then plug out/in the USB–>8 port serial adapter while watching the folder you mentioned previously?

  • Anders

It seems like my USB–>Serial is supported by all Linux kernals from version 2.4.20 and upwards. At least this is ported on this site: http://www.ftdichip.com/Drivers/3rdPartyDrivers.htm. I don’t know how to determine the version of Linux that Vera is build on

You can type uname -a to see the version of the Linux kernel. It’s 2.4 because Broadcom never released wi-fi drivers for 2.6. I’m not good at compiling kernel modules, but I’ll ask our Linux guy to look into adding a few more usb->serial kernel modules and pushing a new firmware on Monday.

I love it!

Aaron,

I decided to start with a RS232 implementation that is two way. That way I believe we can get a how-to guide that will help more users.

Below is the driver code for a digital IO board I had connected to my computer. It was controlled by HomeSeer. It exposes three commands:

  • Init: open the port
  • projectorLiftDown: Set one of the digital outputs HIGH
  • projectorLiftUp: Set one of the digital outputs LOW

If there is uncertainty concerning the spec, let me know and I will make it clearer.

[code]const COMPORT=5 'Serial COM port number on computer
const HEADER=“A” 'Address of Weeder board. Set by DIP switches on the board.

'**********************************************************************
'** Init functions **
'**********************************************************************
sub startup()
'Open COM port
e=hs.OpenComPortex(COMPORT,“9600,n,8,1”,0,"","", chr(3))
if e<> “” then
hs.WriteLog “Error”, “DigitalIO: Failed to open port “&COMPORT&”. Message=” & e
else
hs.WriteLog “DigitalIO”, “Open port “&COMPORT
str=hs.GetComPortData(COMPORT) 'Clean the Rs232 buffer
if str<>”” then hs.writeLog “Debug”, “DigitalIO: data in RS232 bugger that was not handled=”&str
end if
end sub

sub shutdown()
hs.CloseComPort(COMPORT)
end sub

'**********************************************************************
'** Support functions **
'**********************************************************************
function projectorLiftDown()
'Clean up RS232 receive buffer
str=hs.GetComPortData(COMPORT) 'Clean the Rs232 buffer
if str<>"" then hs.writeLog “Warning”, “DigitalIO: data in RS232 bugger that was not handled=”&str

'Send command
send("HA")
retval=getReply(50) 'it typically takes the digitalIO board (weeder) 20ms to reply. Here we wait 50 just in case
    if retval<>"HA" then 
	hs.WriteLog "ERROR", "DigitalIO return value '"&retval&"' is invalid"
	exit function
end if

end function

function projectorLiftUp()
'Clean up RS232 receive buffer
str=hs.GetComPortData(COMPORT) 'Clean the Rs232 buffer
if str<>"" then hs.writeLog “Warning”, “DigitalIO: data in RS232 bugger that was not handled=”&str

'Send command
send("LA")
retval=getReply(50) 'it typically takes the digitalIO board (weeder) 20ms to reply. Here we wait 50 just in case
    if retval<>"LA" then 
	hs.WriteLog "ERROR", "DigitalIO return value '"&retval&"' is invalid"
	exit function
end if

end function

function getReply(delayMS)
hsp.WaitMS delayMS
str=hs.GetComPortData(COMPORT)
if len(str)=0 then
hs.WriteLog “ERROR”, “DigitalIO (weeder) RS232 received empty string”
getReply= “null”
exit function
end if
if not left(str,1) = HEADER then
hs.WriteLog “ERROR”, “DigitalIO (weeder) RS232 start character should be " & HEADER & " The value '”& Asc(left(str,1)) &"’ was received"
getReply= “null”
exit function
end if
if not right(str,1) = chr(13) then
hs.WriteLog “ERROR”, “DigitalIO (weeder) RS232 end character should be ‘13’ The value '”& Asc(right(str,1)) &"’ was received"
getReply= “null”
exit function
end if
str = mid(str,2,len(str)-2)
hs.WriteLog “DigitalIO”, “Received from RS232:” & str
getReply= str
end function

Sub send(code)
hs.SendToComPort(COMPORT), HEADER & code & chr(13)
hs.WriteLog “DigitalIO”, “Port “&COMPORT&”:” & code
End Sub

'DigitalIO (weeder) driver (RS232)
'--------------------------------------------


'\\\\\\\\\\\
'\ Specifications
'\\\\\\\\\\\
'http://www.weedtech.com/wtdio-m.pdf


'\\\\\\\\\\\
'\ Format: Send command
'\\\\\\\\\\\
'HEADER + command & chr(13)
'- command = string of 1-6 bytes
'- chr(13) - the command is terminated with a carriage return
'- example: “A” & “HC” & chr(13) --> set channel “C” to high “H” for weeder device with address “A”


'\\\\\\\\\\\
'\ Format: Response
'\\\\\\\\\\\
'HEADER + command & chr(13)
'- If “ECHO” is on (default), commands send to the weeder board is echoed back to the PC

'\\\\\\\\\\\
'\ Most used commands & reply formats
'\\\\\\\\\\\
’ “HA” --> reply “HA” force port A high (projectorLift down)
’ “LA” --> reply “LA” force port A low (projectorLift up)
[/code]

Thanks for an excellent example!
Do you place Vera “strategically” close to devices it will control, or you run long RS232 cables?

I do both. Some of my RS232 devices are located close to vera, the others are located further away and hence long RS232 cabling.

I do however not see how length of RS232 wires should impact the Vera functionality.

The Serial devices I am going to move from the Windows/HomeSeer installation into Vera is:

  • Somfy wirless motorized shade controll
  • Panasonic Projector AE2000U
  • DigitalIO-weederboard-manual(wtdio-m)
  • Sony receiver (STRDA3100ES)

AFAIK RS232 can handle lengths up to 1000 or 2000ft. The problem with long cabling for me is WAF - so far I couldn’t find a way to hide it well enough…

I have no personal experience with wireless RS232 products, but there are several of them around. With that you should in theory be able to get nice WAF designs.

http://www.wcscnet.com/HdwBTRS232.htm

http://www.datahunter.com/seriallangb.html