Yes it works!

I had stop doing the integration of Raspberry Pi with Comfort system since I completed my Industrial Attachment last June. It is until recently that my FYP requires me to demonstrate the extendability of Raspberry Pi to other home automation system that I come back to the office and retouch the project I left over.

I used the UART of Raspberry Pi to perform serial communication with Comfort system. My boss had been telling me that it would be better if we could use the Ethernet connection instead. I wasn’t very clear of how it should work because the boards and the serial connection have been haunting me for months. I did not even know what keywords to search for in Google.

Yesterday, when I came back to the office again, greet by the friendly smile of my ex-colleagues, sat on the same chair, facing the same laptop and oh hello RaspberryPiServer we meet again.😀

I had a fresher mind after the serial connection failed me and I find it tedious to borrow everything out from the office. I think it would be better if I can remotely access it and demonstrate that to my Profs. So I did a quick search on how to send netcat command in Python and these are some of the results that I found. Today I got a UCM Ethernet module and tested the connection using Comfigurator – works fine! Then using SSH in the terminal, i connect RPi to the UCM using netcat.

nc 1001 //nc followed by the IP address and port number

It is able to connect to UCM so I tried to log in by typing CTRL+V+C LI1234 CTRL+V+M and it returns LU01 which states log in success as user 1.

Next, I tried the following codes which I found here.

import socket
import time

def netcat(hostname, port, content):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((hostname, port))

while 1:
data = s.recv(1024)
if data == "":
print "Received:", repr(data)
print "Connection closed."

netcat ('', 1001, "\x03LI%s\x0D"%passcode)

UCM replies LU01 - success!

UCM replies LU01 – success!

It is able to turn on the test light as well but when I tried to use the browser button to send command, it no longer work.:/ This is what i get:

[09/Jan/2014:14:26:53] HTTP Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/", line 656, in respond
response.body = self.handler()
File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/lib/", line 188, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/", line 34, in __call__
return self.callable(*self.args, **self.kwargs)
File "", line 243, in start
netcat ('', 1001, "\x03O!0100\x0D")
File "", line 227, in netcat
s.connect((hostname, port))
File "/usr/lib/python2.7/", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused

[09/Jan/2014:14:26:53] HTTP
Request Headers:
Content-Length: 13
PRAGMA: no-cache
CONNECTION: keep-alive
USER-AGENT: Mozilla/5.0 (Windows NT 5.1; rv:26.0) Gecko/20100101 Firefox/26.0
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
ACCEPT-ENCODING: gzip, deflate

Update: is now able to control the output test lights using the browser’s button.😀 – i separated the start and request function to have 2 separate netcat functions in them.


  1. Thank you very much for posting your work. I have always wanted to correct the clock on our system and was inspired by your work. I managed to write a python script to syncronise the clock, and will set up a cron job to correct perhaps once a week.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s