Homematic

Forum about Domotiga Open Source Home Automation for Linux.

Moderator: RDNZL

Post Reply
JohanK
Starting Member
Starting Member
Posts: 5
Joined: Wed Mar 07, 2012 8:30 pm

Homematic

Post by JohanK »

Hi,

I've been playing with domotiga and homematic. I can now send and receive messages, but how would I integrate that in Domotiga?
Specially creating the devices in the database, the way commands are sent from the main interface or scripts, how values are stored and used in scripts. For now I just created a class based on the CUL interface, but using the HMLAN adapter. (still extremely basic though)

Johan
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Homematic

Post by RDNZL »

Hi,
Simply find all CUL related stuff in Main.module (both server and client directory) and copy that for your Homematic class.
Create an interface for your module in the database like so:

Code: Select all

mysql -u root -p domotiga
INSERT INTO `interfaces` VALUES (0,'Homematic LAN Interface','Homematic','Read Write');
Then create one or more module types in the module editor with Protocol 'Homematic' decide which address format you want to use.
You should now be able to define your devices and select the correct interface.
If you want to control/switch Homematic devices add the interface id to the end of SELECT CASE in Devices.SetDevice() create a SendCommand in your Homeatic class.
Then when you are satisfied you send me the code and db entries so I can add it to a new version.
Ask specific things if needed.
Regards, Ron.
JohanK
Starting Member
Starting Member
Posts: 5
Joined: Wed Mar 07, 2012 8:30 pm

Re: Homematic

Post by JohanK »

Hi,
It will have to work slightly different. You can't just add a device, it needs to be hardware paired. I've got that covered. The protocol is also bidirectional, working with ack statuses.
I also will need a database table with known devices, so after pairing I can autocreate the device.
One issue I see coming is the amount of values. My room thermostats have certainly over 10 if not 15 that can be written and read.
Currently I'm working to make sending more reliable (the thermostats go in to sleepmode and won't accept commands easily).
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Homematic

Post by RDNZL »

On my todo list is a task to separate the values from the devices table so you can have as many as you want, with labels telling their function, so you can have a field named 'paired' and don't need a separate table to begin with, will try to start with it.
Regards, Ron.
JohanK
Starting Member
Starting Member
Posts: 5
Joined: Wed Mar 07, 2012 8:30 pm

Re: Homematic

Post by JohanK »

With Homematic it is not possible to add the device through the "add device" menu.
Not because domotiga will not allow me but because Homematic devices are (using the pairing protocol) added to the HMLAN adapter, this then allows control via that adapter.
It is possible to monitor devices without pairing.

That brings me to my question
I don't need to have the "interface" in the database, just settings_hm. (did that)
Created a new settings pop-up, including the pairing mechanism.

When a device is paired, it provides type, serial number, address and a few other things.

A new command dialogue sends commands in the format (Public) SendCommand(address, temperature, 20)
A lookuptable (currently a collection) makes sure that only commands supported by the specific device type appear in the drop-down.

Next to do is to integrate/insert the new device in the database, to allow logging and full integration in Domotiga.

I'm a bit at a loss with the various timers in the CUL module, some I'm sure are not required (LED's etc), some I'm sure are (Timeouts) but the OnOff timers I don't know yet.
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Homematic

Post by RDNZL »

I don't know exactly how it looks like now, maybe it's even better than the current way it works :o , but you need to attach the devices to an interface so action in events, and web/control page knows which interface to send the commands to (which SendCommand() to use) when someone wants to control a device.
Storing possible commands together with a device type is also in my list, I will introduce this when I remove the limit of 4 values per device, but this is a big project.
You're welcome to send in the code when you are ready for it, maybe it give me new ideas..

About the timers, you can ignore them, there is a timer for lost tcp connection to the CUL device, a timer to make the led visible, otherwise it blinks to short, and a timer to reset a device state (for a FS20 doorbell which only sends ON)
Regards, Ron.
JohanK
Starting Member
Starting Member
Posts: 5
Joined: Wed Mar 07, 2012 8:30 pm

Re: Homematic

Post by JohanK »

it's probably better if I send you a zip of the project. It's still not nice looking, and some parts need a major cleanup.. And I'm just rewriting the message analysis part, putting it in another sub, and more structured.
Since the devices use several same messagestypes for different purposes, the interpretation is devicetype specific, then messagetype specific. There again I need to link an alias "kitchen thermostat" to an address "123ABE" to a device type "0039" (one of about 50) to make this connection.

regards,
Johan
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Homematic

Post by RDNZL »

Yes, please mail the code to the e-mail address in the README file, and I will take a look.
Regards, Ron.
JohanK
Starting Member
Starting Member
Posts: 5
Joined: Wed Mar 07, 2012 8:30 pm

Re: Homematic

Post by JohanK »

Basic support for HomeMatic is now in Domotiga.
One device is supported, new devices can be added.
First try to pair the new device, and record the information that is recorded in the raw debug log.
To add a device I need the commands which are supported (on/off etc) for this device and the codes used to set these commands.
Ideally these commands are captured from the interface using wireshark, when the device is controlled by the HomeMatics own software.

To change the debug level to raw, currently the loglevel has to be changed using the Gambas IDE (CHomeMatic PUBLIC variables). I will change that in a next revision.
Post Reply

Return to “DomotiGa Forum”