Homematic Thermostat rule

Hi comm,

I hope this belongs here :slight_smile:
I’m pretty new to the game and just got the CCU3 to also control my thermostates over OH.

The problem I’m facing atm is, that there sadly are no samples for rules with the thermostat.
What I need is some kind of idea how I would set up some automation for the thermostats (I’m trying to have a schedule where the heat is set to 22 in the morning and is set back to 17 during the day for example).

So maybe someone of you, has already wrote something like this or could at least push me in the right direction (cause I cant even find anything good on the internet) of where to start.

Thanks in advance :slight_smile:

Btw. I’m using OH2.5 on Windows 2019 with 8.x JRE

I’m afraid your question is a bit to generic :slightly_smiling_face:
Firstly you have think about what you want, from a use-case perspective, then you have to design it and finally there are most likely still several ways to achieve. Especially when it comes to this homematic thermostats :slight_smile:
but, to give you some hint, I can tell you who my setup looks like:
I put a weekly schedule in my thermostats, this is basically the normal schedule I need, considering my working days, weekend and the time slots I’m at home. I’m using homegear, not a CCU, and which homegear you can easily write a script to change this schedule, so I ended up with some predefined schedules I can easily push out to my thermostats. The schedules are (holiday at home, holiday not at home and normal)

when it comes to openhab:
on this homematic thermostat you have two Modes (Auto and Manual), Auto Mode follows the schedule, Normal Mode just uses currently set Set-Temperature. If you are in Auto-Mode and you change your Set-Temperature, the next scheduled temperature will adjust the set temperature. If your in Manual-Mode your Schedule will not be used anymore.

Knowning this I publish on my tablets the current state of each thermostat. It’s running as a HabPanel Widget, there is good one for Homematic in the store, I just slightly adjust it for my needs.
Additionally I use some scenes in my smarthome, like watching TV, dinner, take a shower in the morning, etc. Depending on the scene I perhaps overwrite certain auto schedules via Openhab by keeping the auto-mode and just adjust the current set-temperature.

This is either running as a cron rule with a lot of ifs, or triggered by the scene start. the latter is more elegant, but cannot go over the configure slots in the thermostat. e.g. if my thermostat schedules say 20° until 22:00 and 15° from 22:00, and my WatchTV Scene says 25° and I start it at 21:50, it will be re-written at 22:00 with 15°. Useing a x-minutes cron will write it back once issued.

Last but not least: controlled via voice: I’m using to intents, firstly to get the current status (you can read out the ventile state) and secondly increase or decrease current set-temperature.

hope this helps a bit or gives an idea.


1 Like

Hm I know that it is not really specific but I had no clue where to start :smiley:
With your info, I know have some idea on what to do. I thought I would control EVERYTHING with openHAB but maybe for some solutions, it just does not make sense :smiley:

So thanks for the help, I see what I will do with this

Hi @JustTotallyMe,
you were not completely wrong with your assumption to control everything in openhab. Like @martin111 already wrote, you usually have several ways to achieve your goal.

For sure Martin’s solution is fine, but let me share some additional thoughts.
In comparison to Martin’s solution I wanted to have nearly everything in openhab. This applies not only to the thermostats, but also to all other devices.

In my setup the thermostats are always set to the manual mode - The auto mode is never used. If you’re using the auto mode, the schedule and the temperatures are managed by the CCU itself. In manual mode the CCU never changes any temperatures, but I’m using openhab rules to manage the temperatures.
I recommend you to have a look into the following:
Heating boilerplate with modes
Heating boilerplate DP

The reason why I want to have almost everything in openhab is that openhab should represent my logic layer.
I give you an example:
In the homematic CCU you could create a direct connection between a window sensor and a thermostat, to turn off the thermostat when the window is open. In this scenario you are limited to homematic devices.
If you build a rule in openhab instead to turn off the thermostat in the event of “Window changed to open”, you could use every window sensor which works with openhab.
Another example:
If you want to change the temperatures not just on a schedule, but maybe also on presence, you need to create rules in openhab. But if you have a schedule built in the CCU and logic in openhab, which one will win??


1 Like

well that makes sence too :slight_smile:
so many posibilyties :partying_face: :partying_face:

I am happy for all input on this so I will give everythig a try and see which solution suits my needs the most so also thank you @autossincool for the two links

I’m unfamiliar with these specific thermostats but in my experiences with Honeywell and Nest, openHAB wins. The thermostat maintains it’s native schedule but, just like when you manually walk up to it and change something (e.g. turn up the heat, turn off the fan, adjust the target temp), adjusting the settings in openHAB overrides the schedule, at least until the next schedule adjustment. And if you don’t want that, you can set it to manual mode and then set it back using Rules.

In this case, you can have your cake and eat it to.

1 Like

thats of course also a good possibility. When I setup my setup I was thinking about this option as well, but decided the other way. My main reason was to avoid to much complexity in my openhab rules, however I did not really achieve in my setup since the manual overwrites became pretty complex over time :slight_smile:

indded :slight_smile: Curse and blessing - _meanwhile I think I wrote some of my routines several times with a different concept behind :slight_smile:

1 Like

hello @autossincool

since we discussed this in this thread I’m thinking again about moving my heating schedule away from my homematic thermostat and move it back to openhab.

therefore quick question to you: this openhab rules you mentioned above. Are these all cron rules with a fixed schedule or do you have a fancy logic behind?


Hi @martin111,

Basically the rules are cron triggered rules and they are setting the"preset values".
These preset values are just transferred to the heaters if “Presence” is set to on.

So it’s a mixture of presence and time based heating logic.

hello, thanks for your reply.
do you adjust the heating once presence changed to on?
i’m just thinking, if I heating increases temperature at 18:00, but I’m not here yet, but arrive at 18:05…

I’m currently not at home. I will post my code when back home in a few days.

Reading this now that I got my setup working I am also interested on how you detect presence. Would you use something like the network-binding and check if your phone is connected to the wifi or are you using another kind of detection.

Hi @martin111,

my setup is based on the DP mentioned above.
Basically the preset values will be set all time (crons) - independently if you’re at home or not. These preset values are just transferred to “real” heater items if you’re at home.

    Item Heating_Mode received update or
    Item Heating_UpdateHeater received command ON
    logInfo("heating_mode.rules", "Heating Mode: " + Heating_Mode.state)
    switch Heating_Mode.state {
        case "NORMAL": {
            if(Presence.state == ON){
            	LR_Heating_TargetTemp.sendCommand(LR_Heating_PresetTempNormal.state as Number)
            	BE_Heating_TargetTemp.sendCommand(BE_Heating_PresetTempNormal.state as Number)
            	BA_Heating_TargetTemp.sendCommand(BA_Heating_PresetTempNormal.state as Number)
        case "PARTY": {

// ========================
// Presence changed 
rule "Presence changed - Change Heaters"
    Item Presence changed
    if(Presence.state == ON){
        logInfo(filename, "Turn on heaters, based on presence")

    else if(Presence.state == OFF){
        if(Heating_Mode.state == "NORMAL"){
            logInfo(filename, "Turn off heaters, based on presence")

Hope this helps :slight_smile:

Hi @JustTotallyMe

I’m using this DP to check presence: Generic Presence Detection
Please continue in this thread if you have further questions regarding Presence Detection.

1 Like


I see, thanks! So fundamentally whenever you’re at home, heating is turned on, and if you leave it’s turned off - as simple as it is :slight_smile: