Thermostat bathroom - on/off based on sensor value


So explained in my beginner thread. I start working with openhab tomorrow and slowly move all my zwave devices over. Now I want to get a head start.

I have a scenario I haven’t been able to fix using my existing gateway. Outside my bathroom I have a heating thermostat. This thermostat is called ztrm2 and is new z-wave thermostat from heatit and you support it. Great. This thermostat support floor sensor, internal sensor, effect regulator mode. This bathroom isn’t brand new so I don’t have a floor sensor and since the thermostat is outside the bathroom due to regulations I can’t use the internal sensor. I have now it in dumb effect regulator mode but then it doesn’t take into the account the temperature or even if it’s winter or summertime.

My quick fix for this is to install a multisensor 6 by Aeotec and run it on power.

My rule would be.

If temperature from sensor is under 21 degrees Celsius - turn on thermostat
If temperature from sensor is over 21 degrees Celsius- turn off thermostat

Now I want own rules if no one are home (work hours) and night time. I will probably trigger this states with a wall more by aeotec near the door to start with since I have one and one in then bedroom to set night mode. Since I have no experience with openhab where I can start with adding this rule.

I know I of course need the zwave bindings. Can I use the experimental rules thing to make this? In my head this should be really easy no?


I would say you should have a look at Design Pattern: Time Of Day and also take a look at the astro binding that should give you the answers to your questions.

Of course the general page on rule writing is always useful.

1 Like

Hi Henrik.

I’m also really rookie in OH, so far I have only read quite a bit, purchased a Raspberry Pi 3B+ today and a Z-wave dongle is in the mail. I plan to transfer my whole home automation from Fibaro HC2 to Rpi/OH slowly step by step.

I have lot of concrete floors with water based heating and all of them have floor sensor. As long as you don’t have the possibility to use floor sensors, the approach by using Aeotec multisensor seems like a god idea and also the rule is a good startpoint. Depending on you floor type (concrete/wood) and power/m2 it may work very well or you may get high temperature fluctations in the floor.

It sounds relatively easy but the more conditions you need to take into account the more complex it becomes.

The basic Rule would be pretty simple:

  • trigger the rule on changes to the thermometer and target temp
if(Temp.state < 21) Thermostat.sendCommand(ON)
else if(Temp.state > 21) Thermostat.sendCommand(OFF)

Note between 21.0 and 21.9 nothing happens. This helps avoid flapping when the thermometer is bouncing above and below the threshold a few fractions of a degree.

Now you will have to add further checks to take into consideration presence and time of day. But they would be additional if statements.

I think you can do so. But keep in mind, the Experimental Rules Engine is called “Experimental” for a reason. It is not complete. It is not documented. And there are not many here on this forum who will be able to help. Even if you write this Rule using it, you will eventually have to move to the Rules DSL or JSR223 Rules as you grow your home automation Rules.

In addition to Time of Day, see Generic Presence Detection for how to keep track of presence.