Velbus and Raspberry pi

Hi

Give me a shout if you need access to my BeagleBone unit.

Good luck

Stuart

Jan 2017 >>

If anyone is interested, I’ve created a page on GitHub with instructions on how to setup GuntherVB’s JVelbusD TCP server here :-

**github.com/openremote/Documentation/wiki/JVelbusD-installation-instructions
**

I’m using a velbus server from here on the forum and a selfwritten sockter reader in a android application. But your stuff seems realy usefull to rewrite my app !
The link velbus.tidespark.be/downloads/wi … dk-x86.exe is not working, didn’t take the time to compile it myself yet.

Regards,

Bart

I’m very glad you will find a use for it! Everything is still actively being developed, including the website, so the website is currently only an empty visual shell :slight_smile: Sorry about that!

P.S.: It’s a purely private project that I work on at home, so there will be no support from Velbus itself, please don’t contact them about it.

Can your API be used to send and receive velbus messages easily? That would make it integrate with Domoticz a lot easier :wink:

Please take a look at jvelbus.org/ instead, it is a Java library for communication with Velbus over basic input and output streams. It should be very easy to use and integrate. If you have any questions, contact me through the email address on my GitHub profile.

I’ve been trying to get the velserv.c to work, but i can’t find out what’s wrong.
When running the server everything seems fine, and i can connect using velbuslink from an external system.

pi@raspberrypi:~/velserv $ ./velserv -f -v -v -v -v -v -v Device : /dev/ttyACM0 IP address : 127.0.0.1 Port : 3788 Verbose level : 5 Client mode : 1 Server mode : 1 Velserv: socket is OK... Velserv: setting socket options is OK ... Velserv: bind is OK ... Velserv: server listen is OK ... Velserv: accepting connection Velserv: new connection from 127.0.0.1 on socket 6
But it seems like nothing ever gets in or out the serial port. When scanning for modules from velbuslink i see al the requests passing in velserv, but nothing blinks (more than normal) on the VMB1USB. When i see bus activity on the VMB1USB i can’t see anything in velserv either.

I’ve tried using screen to manually connect to the serial port and verify everything is correct, and that seems to “work”. I do get data back, but it’s not readable. Probably some charset or serial port setting issue.

pi@raspberrypi:~/velserv $ screen /dev/ttyACM0 38400,cs8,-parenb,-cstopb,crtscts
���2�R������������������������ ��� ��������������d�!��������������������������5 ���2�P��1��0������h��

Anyone who has an idea what this could be?

=== EDIT ===
I was running over the code and found out there was a level 8 verbose level that should print the raw serial data. Testing that does seem to work, so it’s actually connecting and reading from the serial port…

pi@raspberrypi:~/velserv $ ./velserv -f -v -v -v -v -v -v -v -v -v
Device        : /dev/ttyACM0
IP address    : 127.0.0.1
Port          : 3788
Verbose level : 8
Client mode   : 1
Server mode   : 1
Velserv: socket is OK...
Velserv: setting socket options is OK ...
Velserv: bind is OK ...
Velserv: server listen is OK ...
Velserv: accepting connection
Velserv: new connection from 127.0.0.1 on socket 6
0F F8 04 04 00 08 00 00 E9 04 0F FB 14 02 F8 02 E6 04 0F FB 30 08 B8 01 00 00 00 00 00 00 05 04 0F FB 04 02 F8 08 F0 04 0F FB 01 02 F8 10 EB 04 0F FB 03 02 F8 10 E9 04 0F FB 04 02 F8 08 F0 04 0F FB 01 02 F8 10 EB 04 0F FB 03 02 F8 10 E9 04 0F FB 30 08 B8 02 00 05 20 00 00 00 DF 04 0F FB 30 08 B8 04 00 00 00 00 00 00 02 04 0F F8 30 04 00 03 00 00 C2 04 0F FB 03 02 F8 10 E9 04 0F FB 14 02 F8 02 E6 04 0F FB 01 02 F8 10 EB 04 0F FB 04 02 F8 08 F0 04 0F FB 03 02 F8 10 E9 04 0F FB 31 08 B8 01 00 0F 20 00 00 00 D5 04 0F FB 31 08 B8 02 00 10 20 00 00 00 D3 04 0F FB 31 08 B8 04 00 00 00 00 00 00 01 04 0F FB 14 02 F6 02 E8 04 0F FB 01 02 F6 10 ED 04 0F FB 04 02 F6 08 F2 04 0F FB 03 02 F6 10 EB 04 0F F8 31 04 00 03 00 00 C1 04 0F F8 04 04 00 00 08 00 E9 04 0F FB 04 02 F6 08 F2 04 0F FB 01 02 F6 10 ED 04 0F FB 03 02 F6 10 EB 04 0F FB 14 02 F6 02 E8 04 0F FB 04 02 F6 08 F2 04 0F FB 01 02 F6 10 ED 04 0F FB 03 02 F6 10 EB 04 0F FB 04 02 F6 08 F2 04 0F FB 01 02 F6 10 ED 04 0F FB 03 02 F6 10 EB 04 0F FB 30 08 B8 01 00 64 80 0

I’m having similar issues. After 4 hours of fiddling with i did get jvelbusd to run and Velbuslink is able to communicate trough jvelbusd with the bus, but i’m looking for a daemon which can run scripts on receiving certain velbus commands, so no luck there. jvelbusd does make it easier to test/run multiple scripts.

With velserv in my case, it only outputs bus debugging info after a client disconnects

[code]root@raspberrypi:/home/pi/velserv# ./velserv -f -v -v -v -v -v -v -v -v -v
Device : /dev/ttyACM0
IP address : 127.0.0.1
Port : 3788
Verbose level : 8
Client mode : 1
Server mode : 1
Velserv: socket is OK…
Velserv: setting socket options is OK …
Velserv: bind is OK …
Velserv: server listen is OK …
Velserv: accepting connection
Velserv: new connection from 127.0.0.1 on socket 6
Velserv: accepting connection
Velserv: new connection from 127.0.0.1 on socket 7
0F FB A3 02 FA 04 53 04 0F FB A3 07 ED 00 3F FF 00 00 C0 61 04 0F F8 A3 04 00 04 00 00 4E 04 0F FB A3 02 F6 FF 5C 04 0F F8 A3 04 00 00 04 00 4E 04 0F FB A3 02 F5 FF 5D 04 0F FB A3 02 F6 02 59 04 0F FB A3 02 F5 09 53 04 0F FB A3 02 F5 04 58 04 Velserv: 127.0.0.1 on socket 7 hung up

Velserv: accepting connection
Velserv: new connection from 127.0.0.1 on socket 7
0F F8 A3 04 00 04 00 00 4E 04 0F FB A3 02 F6 FF 5C 04 0F F8 A3 04 00 00 04 00 4E 04 0F F8 A3 04 00 04 00 00 4E 04 0F F8 A3 04 00 00 04 00 4E 04 0F F8 A3 04 00 04 00 00 4E 04 0F FB A3 02 F5 FF 5D 04 0F F8 A3 04 00 00 04 00 4E 04 0F FB A3 02 F6 02 59 04 0F FB A3 02 F5 09 53 04 0F FB A3 02 F5 04 58 04 0F FB A3 02 F6 FF 5C 04 0F FB A3 02 F5 FF 5D 04 0F FB A3 02 F6 02 59 04 0F FB A3 02 F5 09 53 04 0F FB A3 02 F5 04 58 04 0F FB A3 02 F6 FF 5C 04 0F FB A3 02 F5 FF 5D 04 0F FB A3 02 F6 02 59 04 0F FB A3 02 F5 09 53 04 0F FB A3 02 F5 04 58 04 Velserv: 127.0.0.1 on socket 7 hung up
[/code]

Yeah, same for me. I finally ended up using jvelbusd from jvelbus.org
Had some troubles getting the RXTX lib to work on de Raspberry Pi and for future reference here’s the correct way to install it: wiki.erraweb.com/doku.php?id … ry_pi:rxtx

As for automation i’m going to use Domoticz. It supports some basic programmable logic and variables out of the box (drag 'n drop style), and for the more advanced stuff you can always program your way out.
I have tested a few similar systems and this one has by far the most stable Android app ever, which was important to me. It integrates with lots of other systems, but for now, no velbus support.
Since i’m a programmer i’m going to write my own script to make velbus work with Domoticz. You can find an example on the Domoticz forum and it’s quite straightforward. You’ll need 2 scripts. One for translating the Domoticz “buttons” to velbus commands, and a second script that listens to the velbus for messages and pushes feedback to Domoticz.

Same problem for me, Raspberry with raspbian got a power cut, sd card corrupt… I reinstalled a new fresh raspbian, Jessie lite … And velserv won’t communicate anymore. I tried on another raspberry with openelec and no problem there. So it is something with the new reaspian jessie, I already tried removing some parameters in /boot/cmdline.txt.
But it did not help. The change in cmdline.txt helped for my razberry board on the same pi that also connects serial. and had timeouts after the reinstall. The board did work before the crash without any modifications.

Found something in another thread but didn’t test it yet : raspberrypi.org/forums/view … 8&t=118477

I found the problem with the velbus c server on newer raspbian (jessie) by adding debug printf statements :slight_smile: It was the variable " int start_recv" that wasn’t intialised as 0, probably previous C versions / compilers did this.
After changing it to “int start_recv = 0” (2 times) and recompiling it worked.

changed source code : dl.dropboxusercontent.com/u/762 … /velserv.c
Compiled for raspberry pi : dl.dropboxusercontent.com/u/762 … rv/velserv

to compile it yourself : gcc -o velserv velserv.c -lpthread

don’t forget to “chmod +x velserv”

I didnd’t find jvelbusd as stable as this version in C also cpu and memory usage of java version was much higher.

I also want to add velbus support to domoticz wich is also written in C.
At the moment I added some virtual switches and some bash code to get my velbus components running in domoticz

regards

Bart

[quote=“bheremans”] also want to add velbus support to domoticz wich is also written in C.
At the moment I added some virtual switches and some bash code to get my velbus components running in domoticz
[/quote]

Hi Bart,

If you need a tester for your Domoticz …

Hi Sapien, still need to start with domoticz development. I’m looking now to set up development environment, also it’s a long time ago I did C-code …
I can’t reply private messages on the domoticz board because I don’t have enough posts :slight_smile:

Long time that I came across here, didn’t know that my code was a bit more popular these days. Thank bheremans for your debug, will change it to the original code :slight_smile:

Hi Jeroen,

I’m interested in the velserv.c code, but cannot find it anywhere. The links in this thread are dead. Can you provide it to me ?

Regards,
Danny

Hey @DannyDG,

the one and only true link is: code
I’ll try to make a github in the near future so other can fork this into there project and there’s some version control because I’ve noticed (and got a lot of question) for the older versions of the code.

Thanks for the quick response, but the link is not working. The DNS could not be resolved.

FYI

The link is working for me. @ 17:35

@DannyDG,
you can try http://leachy.duckdns.org/velbus/velserv.c or http://deschepper.dyndns.org/velbus/velserv.c

Today, all links are working again. Jeroen, thanks for the code (and for the effort to provide new links).