First Steps - scripting

I have built a Homegear test system for HomeMatics devices on a Rpi to evaluate. I am trying to achieve heating control with HM radiator valves and HM wall thermostats and importantly only switch on the boiler when there is a demand for heat (therefore when one or more valves are partially open.

I used the stock image with Homegear and OpenHAB and bound to a COC. I followed the install instructions and with the exception of some permission problems (possibly due to my unfamiliarity with UNIX) have managed to get the hardware running ok.

I have two test devices, a wall thermostat (HM-TC-IT-WM-W-EU) and a radiator valve (HM-CC-RT-DN). I can pair the two together, and then pair the wall thermostat to the Rpi controller (using command-line pairing. The Test.php script identifies the two devices ok.

However I am having trouble moving forward with the scripts and being able to talk to the valves to read the valve status (0% - 100%).
Before I get into XML-RPC or anything more complicated I wanted to test the basics from the command-line. After much trial & error I can read the status of the valve by issuing a
print_r($Client->send(“getValue”, array(2, 4, “VALVE_STATE”)));
…however this always reads 100 even after changing the temperature (and hearing that the valve motor has moved). The documentation gives an option to read directly from the device (rather than a cache) by adding a TRUE parameter. However this fails
[faultCode] => -6
[faultString] => Parameter can’t be requested actively.

Can anyone suggest how I can read the valve status in real time?

I guess I would need to poll all of the valves in the house (20) every few minutes to test whether any of the valves were open and if so switch on the boiler (and continue polling to test whether the valves close to switch off the boiler. Does this seem like the correct concept?

Sorry I can’t speak/read German and so cannot pickup many of the HM / Home Automation tips on the Internet.

Are there any sample scripts available that I can ‘decompile’ to understand the scripting methodology?

How can I activate OpenHAB?

Thanks in advance.

Hey riverjet,

Looks good.

Hmm, that’s odd. Have you waited a few minutes after issuing the command to change the temperature? It might take 2 to 3 minutes before the value gets updated in Homegear (that’s the time interval of the status packets sent by the valve drive).

That only works for devices without battery. The option exists, because some of them don’t send status packets.

The simplest way is to poll the value every 3 minutes (to poll more often does not make any sense). The more complicated solution is to implement a RPC server. This server can be registered to Homegear by calling “init” and after that all values are sent to this “event server” immediately as they arrive. You can use one of the libraries for that (HomegearAddonLib [C++, just finished yesterday], HomegearWS {Version 0.6 only} or HomegearLib.NET). There are also ways to implement the RPC server in PHP or Python. The latter probably is the easiest way.

Yes, I would start start out that way.

You just need to set homematic:host to the ip address of your server running Homegear in OpenHAB’s config file (configurations/openhab.cfg).



Hi riverjet,

reading your post i git the feeling that your approach is maybe not the right. Heating control is complex control loop with a lot of parameters and the system (radiators and room) are a tricky thing, because it takes a lot of time to heat a room and the radiator gives still energy to the room even if the temperate is reached. So it is a little bit tricky to create a controll loop.

That the valve state is 100% is maybe right, because the RT-DN measure the temperature and based on the Temperature they open the valve and if the temperature is to low the valve is at 100%. Maybe you can check if the valve state changes if you use the boost funktion. Within my RT-DN the preprogrammed valve state for Boost was 80%. So if the boost starts the valve schould go to 80%.


Thanks for the comments.

I have progressed a little (with a few resets and un-pair/re-pair) and can now read the actual_temp, set_temp, and Valve_state which are all behaving as expected – I can adjust the set_temp and watch and read the valve_state change as expected. It’s actually interesting to watch the algorithm at work by setting a temperature and watching how the valve % responds and adjusts over time.

However I have ended up with just the valve being paired (which is obviously the device I am reading) but the wall-stat is still able to adjust the set_temp of the valve when the wheel is manually turned. In the end I want to always read the valve_state directly at the valve to test if the boiler needs triggering but where a wall-stat is deployed the temperature read/writes need to be directed at that wall-stat.

I probably need to get a second valve to work through all the permutations of pairing but I am happy to have reached the first milestone and got a working system talking to some HM devices.