Controme Smart-Heat

Hi,

For a long time I used RWE / innogy smart home technology to control my underfloor heating.
Unfortunately RWE does not allow to include my gas central heating - definitely a main component of the overall heating system - in its set-up.

Approximately 1 year ago I run over “Controme Smart-Heat” which next to this possibility would also allow to include weather forecasts (e.g. heating is reduced already in the ramp-up phase if temperatures rise higher on the next day, presence detection, heat-pump control, solar heating, etc.) -> https://www.controme.com.

A feature which definitely convinced me to try it out is that this system uses next to a temperatur sensor in each room a temperature measurement of the reflow of each individual heating circuit to control the heating of each room.

My hardware set-up looks like this (one floor as an example):

The complete set-up is controlled by a mini-server based on a raspberrypi:

Controme has published an API (http://support.controme.com/api/) which does allow the implementation within OpenHAB.

In principle I have used the exec-binding to bind Controme to OpenHAB.
The set-up I have chooses is as follows:

One php-script to read the temperture data:

<?php
$Sensor = $argv[1];
$devicelist = json_decode(file_get_contents("[CONTROME_MINI_SERVER-IP]/get/json/v1/1/temps/"), true);
function search($array, $key, $value) 
{ 
    $results = array(); 
    if (is_array($array)) 
    { 
        if (isset($array[$key]) && $array[$key] == $value) 
            $results[] = $array; 
        foreach ($array as $subarray) 
            $results = array_merge($results, search($subarray, $key, $value)); 
    } 
    return $results; 
} 
$key = search($devicelist,'beschreibung', $Sensor);
//print_r($key);
echo round(($key[0]['wert']), 2);
?> 

where $argv[1] is the sensor name you have been configured in the Controme set-up. It will be later defined in the .item file. A second php-file to extract the set-tempertures:

<?php
$Raum = $argv[1];
$devicelist = json_decode(file_get_contents("[CONTROME_MINI_SERVER-IP]/get/json/v1/1/temps/"), true);
function search($array, $key, $value) 
{ 
    $results = array(); 
    if (is_array($array)) 
    { 
        if (isset($array[$key]) && $array[$key] == $value) 
            $results[] = $array; 

        foreach ($array as $subarray) 
            $results = array_merge($results, search($subarray, $key, $value)); 
    } 
    return $results; 
} 
$key = search($devicelist,'name', $Raum);
//print_r($key);
$OffsetGeo = $key[0]['offsets']['geolocation']['raum'];
$OffsetWetter = $key[0]['offsets']['Wetter']['raum'];
$OffsetKal = $key[0]['offsets']['Jahreskalender']['raum'];
$OffsetZeit = $key[0]['offsets']['Zeitschalter']['raum'];
$OffsetTotal = $OffsetGeo + $OffsetWetter + $OffsetKal + $OffsetZeit;
$Solltemperatur = round(($key[0]['solltemperatur']), 2) + $OffsetTotal;
echo $Solltemperatur;
?> 

And last but not least a php- and sh-file to control the set-temperatures:

<?php
$Raum = $argv[1];
$SollTemp = $argv[2];
$devicelist = json_decode(file_get_contents("http://[CONTROME_MINI_SERVER-IP]/get/json/v1/1/temps/"), true);
function search($array, $key, $value) 
{ 
    $results = array(); 
    if (is_array($array)) 
    { 
        if (isset($array[$key]) && $array[$key] == $value) 
            $results[] = $array; 
        foreach ($array as $subarray) 
            $results = array_merge($results, search($subarray, $key, $value)); 
    } 
    return $results; 
} 
$key = search($devicelist,'name', $Raum);
$ID=($key[0]['id']);
shell_exec("/data/.apps/Controme/ContromeTempSet.sh '".$ID."' '".$SollTemp."'> /dev/null 2>&1");
?> 
#!/bin/sh
url='http://[CONTROME_MINI_SERVER-IP]/set/json/v1/1/soll/'$1'/'
curl -X POST -F 'user=user' -F 'password=password' -F 'soll='$2 $url

The implementation within openHAB is - example for one room - as follows:

Number TemperaturBad "Bad [%.1f °C]"  <TemperaturSensor> (Klima, Temperatur, Bad, Raeume) {exec="<[php /data/.apps/Controme/ContromeTemp.php RT_Bad:60000:REGEX((.*?))]"}
Number TemperaturBadRL "Bad RL [%.1f °C]"  <TemperaturRL> (Klima, TemperaturRL, Bad, Raeume) {exec="<[php /data/.apps/Controme/ContromeTemp.php RL_Bad:60000:REGEX((.*?))]"}
Number TemperaturBadSoll "Bad Soll [%.1f °C]"  <TemperaturSensor> (Klima, TemperaturSoll, Bad, Raeume) {exec="<[php /data/.apps/Controme/ContromeTempSoll.php Bad:60000:REGEX((.*?))]"}
Number TemperaturBadSollSet "Bad Soll Set [%.1f °C]" {exec="<[php /data/.apps/Controme/ContromeTempSoll.php Bad:5000:REGEX((.*?))] >[*:php /data/.apps/Controme/ContromeTempSet.php Bad %2$s]"}
String TempBad  "Bad [%s]"  
Text item=TempBad icon="TemperaturSensor" {
  Frame label="Soll Temperatur Bad" {
    Setpoint item=TemperaturBadSollSet step=0.5 minValue=15 maxValue=26 icon="TemperaturSensor"
    }
  }

Any feedback is highly welcome.
Cheers

2 Likes

Hi Jozef,

as this is an international community, please write your posts in english.

Best
Hans-Jörg

Hi Jozef,

As usual, it depends: Assuming that you have a central box where your underfloor heating splits up and you have eight (8) roooms to control you find some prices here:

In regard to you second question:
No, the mini-server of controme cannot be replaced by the OH server.

Nervertheless, for me OH is the central monitoring and controlling interface.

Cheers
Björn

Hi,

i have tried your and failed on diffenrent points (windows-system, openHAB 2,…)
Based on your solution i have implemented a litte Tool to create the needed openHAB-Files based on the provided REST-Configuration:

Thinks i do a litte diffrent:

  1. I use the HTTP Binding with the cache functionality
  2. With the JsonPath transform i select the values out of the JSON-Response
  3. With Proxy-Item the Json-Array gets unpacked and the Set-Temperature get send to the Controme-Server

Hello @BoBiene

thanks for your very nice tool. It helped me to get the Controme temperature into OpenHab and provided me initial insights in how to address the Controme system via curl and POST.

As you seem to be more knowledgable in interfacing the Controme API I hope, that you could help me:

I’m trying to send temperature values into the Controme system as described in the Controme API documentation Setzen von Ist-Temperaturen. I obtained an sensor ID from Controme and received some days later an “Interface-description”, which reads as this:

mini-server-ip/set/sensor-ID/temperatur

(‘temperature’ is the sensor temperature to set)

I tried to use a curl command:

executeCommandLine("curl -X POST -F user=USERNAME -F password=PASWWORD http://MINI_IP_ADDRESS/set/SENSOR_ID/18.7")

(With ‘18.7’ being the value I want to set). However this and related variants didn’t work.

I has a short exchange with Controme, as the Interface description was way shorter, than I expected, and received information, that a GET request should be used in order to set the temperature and not a POST request. So, sth like that:

executeCommandLine("curl -X GET 'http://MINI_IP_ADDRESS/set/SENSOR_ID/18.7'")

However this doesn’t work either. Neither do other combinations, with authentication, following the syntax, which your tool creates, or other methods,as -u USER:PASSWORD.

My REST API interfacing skills are unfortunately not too high, and I wonder whether you have a clue concerning the SensorID question here:
I’m either misinterpreting the interface description I received, use the wrong GET command, or the description is faulty.
( Another direction I tried was to set the Sensor values in the JSON file, which is available under http://MINI_IP_ADDRESS/get/json/v1/2/temps/… (I had no luck here though - this might again be due to y lack of knowledge…)

Any help or hints would be very appreciated.

Hi,

shure no Problem i have some temp and humidity-sensor ids and change the values with a rule:

import java.util.Locale;

rule "Delegate  Temp - SENSOR_ITEM" when Item SENSOR_ITEM changed or
Time cron "0 0/1 * 1/1 * ? *"
then 
var Number temp = ((SENSOR_ITEM.state) as DecimalType).floatValue
executeCommandLine("curl -X GET  http://CONTROME_IP/set/CONTROME_SENSOR_ID/"+String.format(Locale.ROOT,"%.2f/", temp)) 
end 

hope that helps

1 Like

Hi @BoBiene,

thanks a lot! This approach works like a charme and will allow me (and maybe others) to include the existing temperature sensors into controme.
(Java locale.Root was an unknown concept to me and I still wonder, why this type of formatting is necessary…).

Controme is a really great system - the API documentation is very high level though… but over time this forum will probably have sufficient hints!

The Locale.Root is needed to format the value with a dot as decimal seperator.

Hi,

planning to buy a controme System and openhab with PI.

I saw this thread, but is there a clear path/instruction summary of this to use in openhab? tThat would help

Using Openhab sensors een you don’t use any direct connected Thermostat at controme? You set and Display via openhab device? May I ask which ones you use. Looking for some beatiful ones :slight_smile:

Hello @weissertigerxl

Thanks for your interest. Controme is a cool system and the interface to openHAB allows for nice integration into a home automatisation.

Coupling openHAB and controme is easy and straightforward With the help of the script by @BoBiene. Assuming, that you have knowledge of the general concept of openHAB and a bit of staying power, it will be quite easy to develop custom rules in OpenHAB and to make a custom interface for ur heating system on e.g. a tablet using the openHAB panels.

However I would strongly suggest to make your controme system as redundant as possible. It is controlling you heating system and if sth goes wrong in openHAB (and there will , eg. a hanging pi due to updates, LAN problems or such ) you might loose control of your heating for considerable times with evtl catastrophic effects. Having a family , The idea that a programming error on my side woul make my heating stop in freezing winter gives me a creep.
therefore i would as well suggest to invest into controme temperature sensors in each room. Controme offers some wireless ones now, which seems to be really small or you invest in the fancy ones with display and ability to set temperature On the sensor. ( in my case I was upgrading from an existing wired heating system and could simply replace the existing sensors with the most simple ones from controme ). Having the sensors connected to controme system provides a backup In;case openHAB crashes. and as openHAB and controme communicate bi-directional you have the sensor readings In OpenHAB, as you can use openHAB to control the heating system.

I hope this answer helps. My suggestions might sound a bit more complicated and expensive, than it could be. However safety and redundancy first - and fun with sometimes unreliable customized home automatisation second :wink:

Hello Martin,

Thanks for sharing your experience. I am just thinking about which sensors from controversy. I like the idea to integrate into the existing (now to buy new switches eg. From Jung or Gira. It looks the same then. But unfortunately there are only ones which read temperature but not set via a small display, They will offer a new one, but only in white (and not black Color as the switches may come. And always look a bit different. And if you have a standard one to set temperature I am wondering how it would be synchronised with changes to set temperature via web or HomeKit…

I agree it must be independent in any way. As well it is interesting how it be influenced by the new heating system from Bosch with it cw400 Controler and how the rules will overlap or how they work together. But this is another problem and not linked to openable :wink:

Can somebody explane the setup of openHAB 3 + controme for a new openHAB user, please?

I want to like my controme system to open hab and

  1. transfer room temperature data from Netamo and Homee to controme
  2. visualize and steer the controme system by open hab

I have added the openHAB config files to my config share and see the sitemap page with my controme entries and the items
The rules doesn’t work.

Thanks in advance

Hej Mats - welcome to OpenHab

I can answer only 50% of your question, as I do not have migrated to Openhab 3.0 myself. However the principal setup of a connection of the Openhab and Controme system stays the same. Ido not know, what your knowledge about the controme-OpenHab connection is - so please excuse, if all of this is well known to you.

  1. transfer room temperature data from Netamo and Homee to controme

Here you need to obtain one virtual sensor per temperature value you want to send from openhab to contome. These virtual sensors are sold in the Controme webshop for app 10€ each and are in the end of the day solely a sensor address in the controme controller, which you receive from Controme.
A rule in OpenHab can than send an updated temp value from your netatmo or Homme inputs to Controme. To my knowledge OpenHab 3 has different rule engines. The rules in this thread are using the “old” system which is based on a kind of Java language. A pointer might be to understand how this legacy rule engine works in Openhab 3.

  1. visualize and steer the controme system by open hab

The script by @BoBiene does exactly this. If you know the addresses of the Controme sensors this is quite straightforward. at least in OpenHab 2.5 - for Openhab3 there might be some caveats with the different rule engines (see answer above).

I hope this helps you and you can feedback here on the forum about further questions and successes. I will most probably migrate to openHab3.0 soon as well - and hope all will work out with the Controme connection.

1 Like

Hi @mdnx & @Mats,

i’m currently in the migration progress and will update this topic as soon as i have controme running with my OH3 instance.

2 Likes

Hi @mdnx & @Mats,

i have now a version of the tool to use together with the new HTTP v2 binding from OH3:

Things changed with this version:

  • regarding the tool:
    • .NET 5
    • Docker support
  • regarding the autogenerated configuration
    • no rules any more
    • no proxy items
    • generation of http-thing-channels for:
      a. read the current temprature
      b. read and write the target temprature
      c. read the releay states
      d. read and write external sensors (temprature and humidity)
      e. read virtual sensors
      f. read return flow sensors
1 Like

Export works fine, but you need to install .NET5 first

Download .NEt5 runtime from

@BoBiene: Thank you very much for the quick support.

For the Setup of OH3 with Controme I need to learn some more.
Currently I only see the Thing Controme is online. What are the correct settings for the Controme HTTP binding?

i just found this tutorial and added the semantic tags to the item files:

btw. you can use the things file to populate the things and then use the “Add Items from Textual Definition” in dev tools area in the new Web-UI.

After that you can move the created Equipments to the correct group in your semantic model

1 Like

Hi @Mats,

I have just publish a new preview: Release 1.4 beta2 - Added semantic tags · BoBiene/ContromeToOpenHAB (github.com)

you can try this version with the additional item tags the groups should show up in the model.
But if you want to modify the items with the UI you should only place the things file in the config folder and import the items via dev tools and then the import “Add Items from Textual Definition”.

Note: i got an error during import if there was to many items to import. so i had to split the import in two parts

1 Like

Looks very nice!
Worked without any import problems for my house

Now I need to get the communication with my controme server running.

Fellows, I just figured out, that, in case you want to send a temperuature value of external sensor via API, the syntax of the HTTP Get request must be:

mini-server-ip/set/sensor-ID/temperatur/

with trailing backslash, and not, like documented by controme:

mini-server-ip/set/sensor-ID/temperatur

were “temperatur” needs to have the format [dd.dd] always.

BUT: not all numbers are excepted. The Miniserver only accepts a very strange assortment of numbers in the decimals .dd - which is neither rounding nor truncating the muiltiples of .0625 (1/16 degr per bit of the original Dallas DS…). If a value with any other value in the decimals is sent, the date of the last reading becomes actualised, but not the value of the reading.
These are the number controme listenes to:

.00, .06, .12, .19, .25, .31, .38, .44, .50, .56, .62, .69, .75, .81, .88, .94

with this algorithm you may calculate any float to controme accepted digits:

 float temp_coarse= floor(T*2)/2;     // T is true measured float temperature value
 float temp_fine= T-temp_coarse;
 float temp_controme= temp_coarse+ floor(2.0*temp_fine + floor(temp_fine*16) *6.25)/100;

if an other value is sent, the date of the last reading becomes actualised, but not the value of the reading.