Home Automation – KNX/EIB and Linux

January 14th, 2013

I recently received a KNX/EIB-IP Router device from Weinzierl, the IP Router 730 and decided to rethink (or better: re-start) my Home Automation project once again.

I have been looking at OpenRemote as the backend, but found a neat easy-looking project called smartVISU that seems to do just what I need.

I was reading through the requirements, and found that it needs LinKNX and EIBD in the backend to communicate with the IP<->KNX bus router and was blocked by the xml config files for linknx at first. I know it needs to have some kind of connection to the IP-KNP router, but I have no idea how to configure it.

I looked around and found a couple of scripts and commands with options which led to being able to start eibd and linknx in a way that I can issue commands to the EIB/KNX bus:

First I start eibd in daemon mode to connect to the KNX/IP router via:
eibd -d -D -S -T -i ipt:*MY*KNX/IP*ROUTER*IP*ADDRESS*
And after the daemon started (do a ps aux to see if it is running) I start linknx with:
linknx --config=/var/lib/linknx/linknx.xml --daemon=/var/log/linknx.log
where linknx.xml holds:


















Objet test
Current Time
Current Date




1h









All parameters in the xml file were copied from a default ‘test’ config I found.
As I don’t have a KNX input or output block (yet) to check or access in reality, this is all I have (for now)…

I can issue groupswrite commands to it like:
groupswrite ip:localhost 1/1/5 1
No idea what it does right now, but time will tell ;)
It just says :
Send request
Nothing more, nothing less.

In the logfile I specified for linknx I find stuff like:
2013-01-15 21:49:55 [ INFO] XmlInetServer: Starting on port 1028
2013-01-15 21:49:55 [ INFO] Object: Configured object 'test_on_off': gad=1/1/1
2013-01-15 21:49:55 [ INFO] Object: Configured object 'cur_time': gad=1/1/200
2013-01-15 21:49:55 [ INFO] Object: Configured object 'cur_date': gad=1/1/201
2013-01-15 21:49:55 [ INFO] Rule: Rule: Configuring cur_time_date (active=1)
2013-01-15 21:49:55 [ INFO] PeriodicTask: Rescheduled at 2013-1-15 22:49:55 (1358290195)
2013-01-15 21:49:55 [ INFO] Rule: ActionList: Configuring 'on-true' action list
2013-01-15 21:49:55 [ INFO] Action: SetValueAction: Configured for object cur_time with value now
2013-01-15 21:49:55 [ INFO] Action: SetValueAction: Configured for object cur_date with value now
2013-01-15 21:49:55 [ INFO] Rule: Rule: Configuration done
2013-01-15 21:49:55 [ INFO] main: Config file loaded: /var/lib/linknx/linknx.xml
2013-01-15 21:49:55 [ INFO] KnxConnection: KnxConnection: Group socket opened. Waiting for messages.
2013-01-15 22:49:55 [ INFO] TimerManager: TimerTask execution. 1358290195
2013-01-15 22:49:55 [ INFO] Rule: Evaluate rule cur_time_date
2013-01-15 22:49:55 [ INFO] Condition: TimerCondition evaluated as '1'
2013-01-15 22:49:55 [ INFO] Rule: Rule cur_time_date evaluated as 1, prev value was 0
2013-01-15 22:49:55 [ INFO] Rule: Evaluate rule cur_time_date
2013-01-15 22:49:55 [ INFO] Condition: TimerCondition evaluated as '0'
2013-01-15 22:49:55 [ INFO] Rule: Rule cur_time_date evaluated as 0, prev value was 1
2013-01-15 22:49:55 [ INFO] PeriodicTask: Rescheduled at 2013-1-15 23:49:55 (1358293795)
2013-01-15 22:49:55 [ INFO] Action: Execute SetValueAction: set cur_time with value now
2013-01-15 22:49:55 [ INFO] KnxConnection: write(gad=1/1/200, buf, len=5)
2013-01-15 22:49:56 [ INFO] Object: New value 22:49:55 for object cur_time (type: 10.001)
2013-01-15 22:49:56 [ INFO] Action: Execute SetValueAction: set cur_date with value now
2013-01-15 22:49:56 [ INFO] KnxConnection: write(gad=1/1/201, buf, len=5)
2013-01-15 22:49:56 [ INFO] Object: New value 2013-1-15 for object cur_date (type: 11.001)
2013-01-15 22:49:56 [ INFO] Object: New value 2013-1-15 for object cur_date (type: 11.001)
2013-01-15 23:49:55 [ INFO] TimerManager: TimerTask execution. 1358293795
2013-01-15 23:49:55 [ INFO] Rule: Evaluate rule cur_time_date
2013-01-15 23:49:55 [ INFO] Condition: TimerCondition evaluated as '1'
2013-01-15 23:49:55 [ INFO] Rule: Rule cur_time_date evaluated as 1, prev value was 0
2013-01-15 23:49:55 [ INFO] Rule: Evaluate rule cur_time_date
2013-01-15 23:49:55 [ INFO] Condition: TimerCondition evaluated as '0'
2013-01-15 23:49:55 [ INFO] Rule: Rule cur_time_date evaluated as 0, prev value was 1
2013-01-15 23:49:55 [ INFO] PeriodicTask: Rescheduled at 2013-1-16 0:49:55 (1358297395)
2013-01-15 23:49:55 [ INFO] Action: Execute SetValueAction: set cur_time with value now
2013-01-15 23:49:55 [ INFO] KnxConnection: write(gad=1/1/200, buf, len=5)
2013-01-15 23:49:55 [ INFO] Object: New value 23:49:55 for object cur_time (type: 10.001)
2013-01-15 23:49:55 [ INFO] Action: Execute SetValueAction: set cur_date with value now
2013-01-15 23:49:55 [ INFO] KnxConnection: write(gad=1/1/201, buf, len=5)
2013-01-15 23:49:55 [ INFO] Object: New value 2013-1-15 for object cur_date (type: 11.001)
2013-01-15 23:49:55 [ INFO] Object: New value 2013-1-15 for object cur_date (type: 11.001)

So the config file is processed correctly and it looks like communication is working without any problem.

Right now, I’m in search of a KNX input and output module to test with ‘in real life’…
And if that works, let’s talk smartVISU ;)

Advanced Shoutcast Statistics – Part 2

August 2nd, 2011

I’m not sure part 1 has been described here, but we have been using Shoutstats for a couple of month now, which gives us a little bit of history statistics about our streaming usage.

I have been looking for some king of advanced statistics tool or script, or at least one that gives me a little more details than just ‘X listeners’…
After some looking around the last few days and weeks, I stumbled upon http://www.streamsolutions.co.uk/resources/downloads where you can find a package named Statsinternational, mentioned under ‘Shoutcast Log Parser’. It doesn’t need to be able to read the shoutcast logfiles, the statistics page where my shoutstats setup is getting  its info from is enough. You simply put your streaming server url or IP, port and password in the config.php file, and look at the status.php file that comes out. It immediately told me the total amount of webhits (the amount of pageviews to the statistics page, which is in the 100 000 as we pull that info every 2 minutes :p ) AND the total amount of streamhits, which surprised me! As we are a small station, we don’t have a large audience (yet), we already had about 75000 streamhits in 4-5 months time!!! That is A_LOT!

Streamhits are practically the amount of requests for the stream, so a phone with a dodgy connection, having to restart the stream connection every 2 minutes, will count for all the retries and the initial connection.

As an extra, the listeners IP and country (geoip-based) are being displayed, so you can have a guess what people are all listening to your stream.

This little php script gives me a lot of intel on our streaming service, and I’m glad I found it.
I’m still looking for a historical statistics tool that graphs my data like shoutstats does, but with more accurate, and preferably  some ‘searching’ possibility or some routine that lets you select the period you want info on.

Anyone?

Auto-Archiving Audio

July 4th, 2011

In a previous post, I was talking about Flumotion as an automatic, scheduled, disk-archiver for audio.
As the scheduling didn’t work out in the way I wanted, I decided to do it in an easier way.

Using arecord, a small cli program that comes with the alsa-utils, I created separate scripts for every radio show we run.
In this script I set the recording time, specifications and file, including the date of recording.

A script, containing for instance the following:

arecord -d 4200 -f cd -t wav /archive/helpmeout_`date +”%Y%m%d”`.wav

records audio from the default/first audio card (no card specified), to a file helpmeout_ followed by the current date .wav, for 4200 seconds, the duration of the show +5 minutes before and after…

Such a script was made for every show we run weekly, and scheduled in cron.
You can’t make it any easier than this.
Now I just need to post-process it to encode the files to ogg or mp3 to save some space. Piping the command (excluding the filename) to lame, fills the file with static only, so something must be wrong either with lame or the command following my recording settings…

To be continued…
As always: remarks or info are welcome ;)

Flumotion archiving audio

June 8th, 2011

At Stereo03 we broadcast a couple of shows per week, a couple of them per day. Instead of recording the show individually, as we do now, we’d like to do that automatically. Flumotion is THE webcasting/streaming (both for video and audio) solution, which is capable of recording at the same time…

Flumotion holds its configuration inxml files, which are structured and easy to append, where you can add components.
The software uses managers and workers. They can be on the same machine, but can be spread over other machines to balance the load.

One of the components is the ‘disker’, which archives/stores the audio and video in files.
Flumotion even has the ability to use ics files to start and stop the disker/archiving component, so you can schedule recordings.

You can start the manager, workers and configuration/admin from the cli, but the flumotion-admin command/application gives you a nice gui to configure, start and administer the basic steps like streaming video/audio, recording, on-demand audio/video, … But it is limited in customizing the configuration, and I couldn’t find the possibility to save the configuration somewhere to be able to adjust or append it… too bad :(

Now I’ve been looking into how to work out the configuration of such an install, but I can’t seem to manage to get it to work.

I asked the guys over at flumotion if they could give me a hand, and I subscribed to the mailing list. For the moment, I still don’t have a working config running…

If there is anybody that can help me do the following, I’d like to know how you do it:

- record from the first soundcard Line In
-archive/save the audio of the recording in the /archive folder
-start-stop the recording using the shedule.ics file
-have the possibility to overlap by 5 minutes: start at Xh55 and end at Yh05 so we always have the full show in a file

Stereo03 up and running!

March 7th, 2011

A couple of days ago, I told you guys about the student radio project I’m working on/with as a technical coordinator/advisor.

Last saturday, we went live! www.stereo03.be is the place to be to check us out.
There is still lots of work to be done for the website, but at least the stream and basic info is up and running, and we are broadcasting!

We partnered with Movemedia for our streaming needs, as they decided to support us BIG TIME! Many thanks to them for all the help andsupport!

Movemedia lets you view (just like about every other ShoutCast streamer) the ‘right now’ statistics, number of listeners, slots, peaks, average listening time, …

I was looking into a solution to be able to graph these results, and found this project: http://www.glop.org/shoutstats/, which I installed on one of our internal/external servers. After a bit of configging, it displays a nice mrtg/rrdtool graph with the details of the listeners, so we can review daily, weekly, …
This is just what I needed! Thanks everybody in the Internet Broadcasting business and world!

Student Radio – Stereo03

February 17th, 2011

My girlfriend is a journalism student in Antwerpen, where we live, and she wants to start a career in Radio some day.
Last year, the city of Antwerpen started a contest where students and youngsters could present a project for a better city for young people and students in Antwerpen, called Troef!
She and a couple of friends decided it was about time Antwerpen got their own student radio, just like all other major flemish cities with colleges and universities. They presented their idea, and were one of the 4 projects selected that would be funded and supported by the city of Antwerpen.

In september, they used facebook, netlog, posters, personal contact and other channels to spread the word, and try to get everyone to know a radio station for and by students was coming. About 50 volunteers presented theirselves to participate in the project, help us out and make the project work. I myself started the technical side of the radio station, planning and building the studio, searching for software, machines, everything needed to make it work alltogether.

As a broadcast license for an FM frequency is nearly impossible at this moment, as no frequencies are available and won’t be until 2016 when the frequency planning will be reviewed, we will keep broadcasting through the internet for now. Our partner Destiny provided us with a vdsl2 connection in the studio, which will transport our stream to MoveMedia who will distribute the stream.

We have the support of the REC Radiocentrum that is our supporting partner. They provide the financial guidance, project management, educational parts and materials for our radio station.

We had a couple of site visits to find an ideal place to set up the studio. We talked to Trix, an organisation about music and art that allows people to express themselves in a musical way by providing room for rehearsals, courses, concerts, … They wanted to help us out anyhow. We talked to a couple of concert and theater halls in the center of the city, but we ended up in Kavka, a youth center right in the center of Antwerpen. They had a basement that could be rearranged as a studio/working spot, while inside that basement there already was a ‘recording booth’, a room with drywall dividers, carpet wall finishing, ceiling covered with sound absorbing materials, a plexi window, … We just needed to install our equipment and we were on a roll…

We put in a new laminated flooring on top of the concrete floor, repainted the entire basement, partly put new electrical wiring in, put network wiring in, redid lighting on the ceilings, and started designing the ideal studio and room setup. Google Sketchup helped me create an idea, and try it before we ordered all the materials, got me a perfect look about how I wanted the studio too look like in the end and helped me keep focus on the implementation and placement of all the parts needed.

We got a Dateq BCS 70 broadcast mixer, a couple of Rode NT1a microphones on booms, Sennheiser headphones, Dell PC’s with Radiohost Radio Automation software, a Presonus Firewire audio card and lots of wiring from REC and started building our studio.

A couple of weeks later now, we’re in the middle of trials, education, and planning the radio shows, as we are going ‘On Air’ on the 5th of March 2011.

That day, a technical challenge already presents itself: we’re going live from the studio from 10am broadcasting music, interviews and live sets, and at 4pm we’re broadcasting live from the Antwerp Central Station, where the kickoff of the Antwerp European Youth Capital 2011 will be held. Local bands will play on 2 stages in the station , and our radio station Stereo03 will be broadcasting interviews, parts of the live sets, live from the station.

Let’s hope everything goes well… still lots of work to be done and lots of tests to be performed before we can start…

Check what hardware’s in your server(s)

December 10th, 2010

From time to time, for upgrading or replacement needs, I need to know which motherboard, CPU or chipset is in my server. For lots of machines, I know these details, for others, I have to look them up every time.

Some time ago I stumbled upon a great tool dmidecode which displays all DMI data, and I must say it displays A LOT!

For reference, the dmidecode explanation I used can be found here.

Just in case I forget it again, and have to look it up once more… ;)

FreeNAS iSCSI and VMWare ESXi

September 3rd, 2010

For a long time I’ve been using NFS to serve the diskspace my FreeNas server has, to my ESXi machine, and ‘ve been wondering if iSCSI would be a better solution. NFS has more overhead than iSCSI, so iSCSI should outperform NFS on higher workloads.
I’ve never really taken the time to get to know iSCSI and it alwasy looked very messy and difficult to set up and use. But today, that idea changed!

We’ve been running ESXi at the office for a couple of weeks too in a test environment, and are investigating the necessities for a production installation at one of our clients. They’ll have 2 servers (1 master, 1 ‘spare’) and a shared NAS/SAN solution to store the virtual disks. As performance is necessary there (I didn’t really care for my own setup at home, as long as it is reliable), I was looking for a simple howto description to use iSCSI on the ESXi side, and tried that with my own FreeNAS storage machine.

Following this guide I found a detailed description of the configuration needed in FreeNAS to get it up and running in 10 minutes. It really did it!
An iSCSI datastore is connected now onto my ESXi machine, for testing. I only took 50GB to test with, as I’m thinking of redesigning my FreeNAS box with another motherboard, raid controller and disk setup, as the current Dual AMD Opteron with 12GB RAM is a bit overkill, and too power hungry… As I don’t have a decent motherboard that supports the Raid controllers I currently use (PCI-X based), I need to rethink the setup and get me a decent PCI-e x4/x8 controller capable of holding 8 to 12 disks (2 controller setup is just fine, even 3 controllers might do if it costs less that way.) When I finish that migration and get all the data copied over, I’ll setup the FreeNAS-ESXi connection on a purely iSCSI based setup…

We’ll see…

mc2xml stopped working

August 14th, 2010

Apparently, mc2xml, the software package that downloads and xml-formats the electronic program guide information to my MythTV installation, stopped working a couple of days ago… EPG data is empty after tonight :(

The original site is down, and I checked a couple of forums. They all point to a new site where you can simply download the new package, and start downloading again… luckily…

Linux Virtualization – OpenVZ/Proxmox

August 11th, 2010

In times of economical troubles, a small company needs to look for money-saving ideas and use them to take their infrastructure to a less costly setup with the same (or at least nearly) power and possibilities.
For that reason, over the last 2 years we were looking into both energy efficient hardware and virtualization solutions to get the most out of our machines in the datacenter. Every single Ampère costs us a lot of money every month. To save energy, we fitted our backupservers with Western Digital Green Power drives instead of the standard Raid Editions we had before, as we did have to expand the Raid volume anyway.

Another way of reducing the power needs is virtualization some of the separate machines, so the total of our servers could be scaled down a little.
We had a couple of servers used for web- and ftp traffic, which weren’t utilized 100%, not even 25%…
After an inside testing setup with OpenVZ, a container based Linux virtualization solution, we looked into expanding it onto our datacenter installations. The big problem here was the VLAN setup we use in the datacenter, to separate all client networks. Apparently OpenVZ doesn’t really cope well with VLAN’s, or at least there is not that much info about the usage and configuration of setting up containers in separate VLAN’s.
Looking into GUI-possibilities, web based management options for OpenVZ, we stumbled upon Proxmox VE which is an all-in-one distribution, supporting OpenVZ, KVM etc as virtualization options, and which has a nice and full-featured web based management console.

Setting up machines in Proxmox is really easy. You can choose which virtualization environment you want to use (KVM or OpenVZ containers). KVM allows you to run different OS’es next to each other, like Windows servers, BSD etc, while OpenVZ uses the same basic kernel, but allows the containers to be run independently, giving a very low overhead, and maximum performance.
OpenVZ containers are ‘template based’, and Proxmox has a list of already defined and downloadable templates like Debian 4, 5 and 6, Ubuntu 8.04, their own Proxmox email security suite (I think you need a license for this), but also predefined WordPress, Drupal, Zenoss monitoring, Joomla, Mediawiki, …
You can download the ones you need or want to deploy, and a couple of minutes later, the template is ready to be used (depending on your internet connection speed, off course)
Once you have one or more templates, defining a container’ed machine is easy as hell: Create a new ‘machine’, choose OpenVZ as the type, select the template, define a root password for accessing the machine, and select network, disk space etc… When clicking the create button, Proxmox will set up your environment, which will be ready for use in minutes.

VLAN integration with the Proxmox web console is really easy: all you need to do is define extra interfaces as ethx.yyyy where x is the ethernet interface number, and yyyy is your VLAN ID.
Once those were all set, we could define a container, and assign a vmbr bridged network connection to it, which holds the VLAN tag info.

We migrated 4 ftp and webservers in a matter of hours instead of days. Most of the time went into syncing the data between the old and the new machines.

An extra option in Proxmox is defining separate storage possibilities, for example local storage, iSCSI, NFS, … for (automated) backup and snapshot storage…

Proxmox hosts can be ‘joined’ into a cluster, so you can migrate containers between hosts, without downtime, interruption, big troubles or manual intervention. That way you can move machines needing more memory, or migrate to heavier hardware, perform hardware maintenance and have the most important machine run on a backup host server, without the long-time interruptions, and stress accompanied with such a migration or maintenance.

Proxmox is, for Linux virtualization, my favorite now, far above any other solution we have been using in the past.