Flex Velbus connection demo tool

I made a flex tool that connects to the Velbus over a socket connection.

http://sites.stogo.net/stogo/screenshot3small.jpg

Although the tool is far from ready here is some info about it and a link to the Flex source code.

[edit]
You can download the **latest **code and demo at code.google.com/p/flexvelbussocket/
Latest download: r16: run an exe when a button is pressed
[/edit]

The tool is made with Adobe Flex Builder 3.

In order to run it you have to start up the Velbuslink software, connect to your Velbus, and select “Velbus > server mode” from the menu.
This will make it possible to connect to the velbus using a socket connection at ip 127.0.0.1 (localhost), port 3788. Of course if you share your pc you can also connect to it from anyware on your LAN/WAN network of even from the internet. It’s Flash, so some modern PDA’s that have Flash 9 on board can run it :slight_smile:

The flex tool itself (which is an swf file) can be run from a html site or directly from your hard drive. The html to start it up can be found at bin-debug\TelnetSocket.html.

In the xml file at bin-debug\data.xml you can enter all your commands that you want to show up in the grid (eg “Living Aan”, “Living Uit”).
Clicking the row will send the corresponding velbus data. For now you have to fill in the raw data string including checksum in the xml file. The easiest way to have some test data is to put the logging on in the Velbuslink (“View >Window > Traffic log”) and send some traffic over your velbus by clicking some buttons of your TVMB4PD or TVMB8PB. The hex data in the Raw colum has to be copied in the xml.
eg:
http://sites.stogo.net/stogo/xmlSnap.jpg

The middle part of the tool displays the traffic on the network. nothing fancy here …

Don’t mind the lower part of the tool “(stubru: Geen muziek(info) - )” as it has no purpose yet.
This shows the currently playing song at the radio station “Studio Brussel”. I am busy right now making this song info available at the display of my TVMB4PD.

Next feature would be to connect with Windows Media Player, receive status info and send play/pause/volume commands. Hower I can not find a socket connection to the media player :frowning: Is there anybody that can help me out here?

As you can see the code is still very basic: I need to write a Packet class (like the C# version from Velleman) in order to have some higher abstractions. Hope I find some time soon …
[Edit] Packet class is finished now.[/edit]

[Edit]*If you get a security warning or don’t see any data, add the swf to the ‘trusted sites’. This can be done online here: macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html *[/Edit]

As always: Any help / hints / comments are welcome :slight_smile:

thanks,
Gert

Gert,

This really look promising! Great work!

I just received all modules to change mu current setup. Once that is done, I will start also ‘programming’ things with this concept…

I keep you all informed!

Bart

Gert,

I am trying things out, but when I open up the HTML file I get the error requiredMajorVersion is undefined.

I am going to try for myself a bit of changing in HTML code but I wanted to let you know for future versions…

Bart

Probably because you have a Flash player earlier then 9?
Right-click on the swf to know the Flash player version …

Or may be the javascipt file (AC_OETags.js) is missing? Did you copy(unzip) the entire folder structure?

If you still have this error please post a screenshot of the error …

Gert,

I found out what was the problem… I was using the wrong html file under html-template…
When I open the correct html file from bin-debug, I get a screen splitted up in 2 columns (command / velbus data) but under it all lines are empty. So I don’t see Living Aan and Living Uit. At the bottom I see also the lines from Velbus Command & StuBru but all seems static, can’t select or click anything.

Any clue? I have the latest version of Flash installed. Velbus soft is running on the same PC in server mode.

Bart

It looks like the tool can not find the data.xml file which should be also under bin_debug. Did you unzip that file too?

if you do modifications to the xml file (which is needed because your commands should be filled in), also check that the xml is valid. E.g. by opening it in Internet Explorer.

Gert,

Yes I extracted the complete zip file… The XML file and the .js file are there too… I can open the XML file in Internet Explorer without a problem:

<?xml version="1.0" ?>
  • Living Aan 0FF80305070164FFFF8704
  • Living Uit 0FF80305070100FFFFeb04

Could this be because you have the development tool locally installed on your PC? Did you try it on another PC?
I tried it on my portable and my fix PC, both with the same result…

Hm, don’t know what’s going wrong - I will try to run it on an other pc tomorrow …

Gert,

Feel free to let me know what I should try or test, I am willing to help you with all this… If needed I can try to install the software itself? It is Adobe Flex or something like that?

An interesting function also what would be great is a screen where you can see all the status of all lights of a floor if they are on or off… Just an idea…

Grtz,
Bart

Hi Bart,

I found the issue you may have - it has to do with line 43 in the Telnet.as class: this line has to be removed - it is depreciated code (not working anymore with non-debugging flash players).

I will post a new zip with working demo asap, but I’m in the middle of some new stuff, so I want to finalise this first.
However if you have flex 3 of flashDevelop you can recompile it yourselve.

Gert

New Version
Download the link above to get the latest version.

Most of the changes are under the hood, but neccesary to build upon.

I implemented an AS3 Packet class (simular like the C# class of Velleman).
This will be the base class to extend all other ‘Module’ classes …

The parsing of packets on the bus has also been finetuned and works now with the Packet Class.

Here’s a screenshot:

sites.stogo.net/stogo/screenshot2.jpg

(moderator: please supply link to large screenshots)

Gert,

This looks promising, however I downloaded the new version but don’t get the content of the XML file displayed… The screen stays empty. At the bottom the window with songs fom Studio Brussel works, I can see which songs they are playing. I checked the version of Flash, all security settings, I even created the same folder structure on D:… to be sure, but either of it seems to help…?

Kind regards,
Bart

Hmm, it’s a security error because the swf is run locally …
so the swf has to be added as a trusted file.
Here’s how:

Sorry for the hassle.

Gert

Gert,

This is indeed the solution, everything seems to work now…

I am going to connect all my modules the upcoming days and weeks in my house and will use your tool on my touchscreen portable to control everything.

Next feature which would be great is that U create tabs at the top or the bottom to select multiple floors for instance in case the display is not big enough to display all lines.

Further would it be great if there could be an overview of all lights in your house with their status, to see quickly before goi,g to bed if all lights are shut. Can I for instance adapt myself the swf file (if I can get the source file offcourse) with the apropriate Flash software?

Final request would be the possibility to enter in a XML or other config file the IP adress of the PC where the Velbus runs on. Now the HTML file must be ran from the same machine where the Velbus software is running and the physical connection with the Velbus.

I know it is a lot, but the tool is very promissing and I think a lot of people will be interested in it!

Keep up the good work!

Grtz,
Bart

I will first try to make a nice status screen, show the status of all relays and dimmers.

Later on a touchscreen interface with several tabs and larger buttons is also on my to-do-list. But it is not a priority for me, so no promises on that.

It will also be possible to add velbus commands in a more user-friendly way in the xml.
something like this:

[code]
Keukentafel traag uit (the smart way)

02 low false 070100001F [/code]

I am working on that right now.

The code can be freely downloaded and used. You need Flex 3 or FlashDevelop to compile the code.[/code]

Bart, what do you mean with a touchscreen portable? I’m also looking for some touchscreen device that woul work as a remote. But I did not any (non-expensive) sollution :frowning: Hints are welcome!

Gert,

Can I create also an adapted SWF file (with for instance another layout) also with Flex Developer? If so, I will try to find the software (since it is licensed…)

What I have in mind is or a PDA like thing like my HTC TYTN and HTC Diamond now (with a 2,8" screen) or a tablet PC that I have now for my work (12" touchscreen, I have one from HP now and a my previous Toshiba doing nothing for the moment). The touchscreen can be turned around (so with no keyboard visible) so I want to try to build it in in the wall or in the kitchen or so (our living room is one big space…). Then with Vista or XP on it, I can schedule a screensaver with all pictures going around from my little daughter, and when I touch the screen I get the Velbus Flex tool where I can check and control my lights.

One other option is my universal remote control Pronto (from Philips TSU9600 pronto.philips.com/index.cfm?id=1303) but that one can’t play Flash files, but with IR via RF I can control the VMB4PD on distance anyway so that it is less important.

Grtz,
Bart

Adobe Flex Builder is the best tool to skin the interface, but is not for free. The open-source alternative is www.FlashDevelop.org, a very good actionscript editor, but more focus on programming and no wysiwyg skinning.

In the mean time I uploaded a new version that can handle 2 ways of xml formatting:
like so:

<command> <label>Keukentafel traag uit</label> <data>0ff80205070100001fcb04</data> </command>
or like so:

<command> <label>Keukentafel traag uit (the smart way)</label> <address>02</address> <priority>low</priority> <rtr>false</rtr> <data>070100001F</data> </command>

Its now also possible to change the server address and port in the data.xml:

<data velbusServerAddress="127.0.0.1" velbusServerPort="3788">

Updated download available at the first post of this thread.

Gert

Great job! Thanks!

A new version is available.
The tool now scans for modules and shows the found modules with their name(s).

http://stogo.net/varia/velbus/screenshot3small.jpg

I shared the sources on Google Code, so anyone can have a look. Feel free to participate in the project - you can update and merge code using subversion. :wink:
You can download the **latest **code and demo at code.google.com/p/flexvelbussocket/

I still have some problems with Packets that are not received on my socket - probably because of too much traffic (may be I send commands too fast …?) - will be investigated soon …

Gert

A new version (r14) with download is available at google code.

As you can see i did some skin changes - I like the black styles skin :wink:
Also the led events on a button are catched an show in the interface now.