Page 1 of 1

Velbus support with external scripts

Posted: Friday 30 October 2015 13:05
by Sappien
Hello,

Since Domoticz doesn't support Velbus I had to make a other solution for controlling it..

Image

I don't have programming skills, so the code can be messy.. (at this moment Linux only)

I'm using the Velbus USB interface to connect to the Velbus bus.

First we need the velbus server which can be downloaded here :https://dl.dropboxusercontent.com/u/112 ... /velserv.c

(this server creates a network socket to the usb device, so multiple clients can connect)

and compile with gcc -o velserv velserv.c -lpthread

Code: Select all

Velserv acts as a gateway between the Velbus interface and the network
Usage: velserv [-csfvhV] [-d DEVICE] [-a ADDRESS] [-p PORT]
-s --server             act as server only, gateway will be disabled
                            when in server mode, the address is always 127.0.0.1
-c --client             act as client only, server wil be disabled
-d --device INTERFACE   device where the Velbus interface is connected to
                            default device is: /dev/ttyACM0
-a --address HOST       IP address or hostname where to connect to as client
                            default is 127.0.0.1
-p --port PORT          port where to connect
                            default is 3788
-f --foreground         do not run in background
-v --verbose            verbose operation, repeat for debugging output
                            1 general debug, 2-3 com to socket debug, 4-6 server socket debug
-h --help               print this help and exit
-V --version            print version information and exit
To check the connectiviy you can use the Velbuslink tool

Image

To control a Velbus module you can use the following client script : Velbus-send.pl

./velbus-send.pl (addres of unit) (status) (device)

Example (4 Ch relay module)

./velbus-send.pl 01 02 01 (sends the ON command to device address 01 relay 1
./velbus-send.pl 01 01 01 (sends the OFF command to device address 01 relay 1

./velbus-send.pl 01 02 08 (sends the ON command to device address 01 relay 4
./velbus-send.pl 01 01 08 (sends the OFF command to device address 01 relay 4


Next step is adding it to Domoticz and make a listener scripts, so the actions from the velbus are send to Domoticz (pressing a button etc)

Re: Velbus support with external scripts

Posted: Tuesday 03 November 2015 14:35
by Sappien
The listener script is also working, so the buttons in Domoticz are "synced" with the hardware switch

Image

Re: Velbus support with external scripts

Posted: Saturday 28 November 2015 7:52
by Sappien
My own velbus installation is almost ready...

Image

Re: Velbus support with external scripts

Posted: Sunday 29 November 2015 18:49
by ThinkPad
Cool! Keep posting, i find it very interesting!

I see you speak Dutch, have a look at this topic: http://gathering.tweakers.net/forum/lis ... es/1632953 ("Domotica met PLC's").
Might be interesting/useful for you

Re: Velbus support with external scripts

Posted: Sunday 29 November 2015 19:44
by Sappien
Next week should it be up@running.

Every light switch is a Jung pulse button which is conntected to a channel input. That was the cheapest option for now. I've got 2 Velbus switches (with oled display) for the living room and hallway.

Velbus doesn't need a central unit, so every unit can communicate with other Velbus devices. WAF approved :D

I received a PM from Rob, maybe native support in the future 8-)

Re: Velbus support with external scripts

Posted: Sunday 27 December 2015 18:19
by Sappien
I've integrated my Ventilation unit on my Velbus touch display.

I've "sniffed" the bus address of the unused buttons, so when that button is pressed a script will be executed. This script also (de)activates the status led of the buttons.

Image

The touch display has a builtin temperature sensor which also can be used with Domoticz (again with a little script :roll: )

Re: Velbus support with external scripts

Posted: Monday 04 January 2016 22:10
by Fluxlicious
Hi Sappien,

I found your thread in search for a system that works with Velbus. I'm sill exploring different systems, but for the moment this one is my favorite as it supports lots of other hardware i have, and would like to have, out of the box and it supports basic logic operators.

Anyway, i'm playing with your script, but i can't figure out how your script should be used. I also cant seem to find some kind of documentation on how to use scripts like yours.
I have created a dummy swith and added this to the On and Off action:
ON: script://velbus-send.pl 01 02 01
OFF: script://velbus-send.pl 01 01 01

But this doesn't seem to work. I'm also not seeing an incomming connections on the velbus tcp server so i'm guessing its not getting executed.
Any suggestion, or maybe a link to some documentation that applies to your script? I'm a programmer myself, so i'll figure it out, but the domoticz wiki about scripts doesn't seem to make sense with your script.

Re: Velbus support with external scripts

Posted: Thursday 21 January 2016 23:24
by kona
Hi Sappien,

I'm also having the velbus system installed at home and now trying to connect through Domoticz.
I'm using a rapsberry and the velserv code to connect to the velbus. I'm able to connect to the velbus with the velbuslink tool, so that's working!
I was also able to install the domoticz portal and can connect to it via a browser.

When trying to install my hardware, the only setup where devices are recognized is through the harware type "Domoticz - Remote server".
But with this hardware type no light switches can be configured.

Which type of harware do you connect with in domoticz and how are you able to setup for example light switches.

Thanks in advance for the feedback!

Re: Velbus support with external scripts

Posted: Tuesday 19 April 2016 21:16
by bheremans
Thx for the send scripts that I use now in Domoticz çç

Can I download the listener / receive scripts somewhere ?

Re: Velbus support with external scripts

Posted: Wednesday 20 April 2016 8:35
by Sappien
Fluxlicious wrote:Hi Sappien,

I found your thread in search for a system that works with Velbus. I'm sill exploring different systems, but for the moment this one is my favorite as it supports lots of other hardware i have, and would like to have, out of the box and it supports basic logic operators.

Anyway, i'm playing with your script, but i can't figure out how your script should be used. I also cant seem to find some kind of documentation on how to use scripts like yours.
I have created a dummy swith and added this to the On and Off action:
ON: script://velbus-send.pl 01 02 01
OFF: script://velbus-send.pl 01 01 01

But this doesn't seem to work. I'm also not seeing an incomming connections on the velbus tcp server so i'm guessing its not getting executed.
Any suggestion, or maybe a link to some documentation that applies to your script? I'm a programmer myself, so i'll figure it out, but the domoticz wiki about scripts doesn't seem to make sense with your script.
Hmm, I missed the notification of new repleys.. When you run VelbusLink at the same time you can check the commands who are send to the velbus network. What are the id's of the unit you're trying to control?

(Still hoping for native Domoticz support :ugeek: )

Re: Velbus support with external scripts

Posted: Wednesday 03 August 2016 12:42
by Sappien
bheremans wrote:Thx for the send scripts that I use now in Domoticz çç

Can I download the listener / receive scripts somewhere ?
I've added some Perl scripts

temp -> reading temperature from velbus sensor
velbus-client -> catch data and respond to it with a action
velbus-send -> send a action to a velbus device

The scripts are based from the velbus forum and a little adjusted for my own usage..

Code: Select all

# Switch Relay WC off
  			if ("$velbus" eq ("0FFB2008FB01000000000000D204") ){
				$idx = ("18");
				if(&json_q eq "On") {
                       		system( "curl", "http://$domoticz/json.htm?type=command&param=udevice&idx=18&nvalue=0&svalue=" );
				}

Re: Velbus support with external scripts

Posted: Thursday 04 August 2016 10:05
by Sappien
kona wrote:Hi Sappien,

When trying to install my hardware, the only setup where devices are recognized is through the harware type "Domoticz - Remote server".
But with this hardware type no light switches can be configured.
You need to add dummy devices.. The client script changes the state of the dummy's.

This script is not user friendly.. :geek:

Native support would be the best solution.. With a scan feature, so you don't have to capture the address of the unit etc..
Unfortunately I don't have the skills to fix that..

Re: Velbus support with external scripts

Posted: Thursday 04 August 2016 18:05
by Fluxlicious
Hi Sappien,

I can't respond to your PM because I haven't made enough posts on this forum yet :p
Anyway, in response to your pm, yes i'm still working with Velbus (and will continue to) and i also created a similar way of working with Domoticz and Velbus. I have 3 buttons working with feedback, but i'm not using Domoticz in a useful kind of way right now, just playing around with it.
It took me a while to fully understand the concept of getting the relay status and update the button status in Domoticz. I spent quite some time looking for a way to make Domoticz "read" the status of the velbus while instead you need to create a separate application / script to monitor the velbus yourself and update the dummy button in domoticz using the api when needed. I still need to look further into this because i want to be able to use the if/else logic and variables from domoticz to create some basic logic switching and i haven't had the time yet to discover how this logic works.