FIBARO: Heating off when window open – How to save real cash

by crissxcross22. February 2016

The FIBARO system will turn your heating off, when a window is opened or your flat abandoned.

Daniel programmed this LUA-script (really cool) and in the following article I will try to explain to you how it works.

Features v.0.1:

  • pauses heating when:
    • window is open
    • absence
  • different temperature settings by open windows and absence
  • recognizes if window is opened only for a very short timeperiod or in order of ventilation
  • checks for open windows by absence and arriving
  • goes back to regular heating, when window is closed or someone arrives

I think I have to start right at the beginning. I asked Daniel to programm a solution, which turns off the heating when a window is opened. But after the window is closed again, the heating should go back to regular heating mode.
Last year Alex posted a quite nice script in our forum, which exactly covers this issue. I am using this script by myself for over a year now and it mostly works. Why „mostly“?
It works in the following way: When a window is opened, the script waits if it will stay open for more than one minute. Then the actually set temperature of the heating will be saved in a global variable and the heating turned down. When closing the window, the LUA-script will set the primary temperature by asking the global variable.

Now the following problem can occure: I open a window at 4:00 p.m.. A temperature of 23°C is saved as the global variable. In my system is 4:30 p.m. set as the point of time, at which the temperature should be turned down to 19°C. But when I close the window at 4:35 p.m. the lower temperature of 19°C will be ignored and the script will set the primary temperature of 23°C.

Even for the absence-mode is the script quite difficult, because the Danfoss thermostat needs a temperature setting and a timestamp. This stamp indicates, how long the transmitted temparature is valid. Here is a maximum of 6 hours possible. Afterwards the thermostat switches back to regular heating.

If it switches back to regular heating, why not use it for windows? Well, when I am opening a window, I am not sure about the timeframe in which the window should stay open.

FIBARO pausing heating mode


Again from Alex, we got this script, which is originally published by FIBARO and became modified by Alex. This script uses the „holiday mode“ to pause the heating. This is just ingenious and delivered Daniel the base for the following script.

What does the new FIBARO heating-script?

It does not adress a thermostat and send them temperature settings, but it activates the „holiday mode“, in which a defined temperature is set for every room. This temperature will be hold until the „holiday mode“ is deactivated.


A great thing in combination with the perfect light control

Recently we presented you a lot of scripts and some of them were really complex. All in all is a smarthome an issue, growing on a modular basis, but nevertheless any device and any script works as a integrated whole.

In the LUA-script about perfect light control, every light will be turned off, when the global variable „PresentState“ switches from „Home“ to „Away“. This variable is also included in our heating script. Because not only when opening a window, but also when you are leaving your house, respectively your flat, the heating will be turned down.
I use the RFID-script written by Daniel with the „PresentState“-variable (instead oft he „rfid_alarm“-variable as proposed by Daniel). So when I am leaving the house and arming my alarm system via RFID-Tag or card, the DanaLock will close the door, the vacuum cleaner will start his work, all lights will be turned down and even the heating will be lowered in every room individually.

I use for example 5°C for open windows, so that the valve will be closed completely. When absence, the temperature will be lowered to 19°C, in order to keep a certain basic temperature in every room.

What happens when I leave the house and a window is still open?

The script checks if there are still any open windows and will not set the temperature defined for absence, but will keep the temperature set for open windows. Same happens when someone enters the house while a window is open.


What do i need do adapt within the script?

Not much. Let us start right at the beginning of the script. Following the logic, we have to set the trigger inside the properties.

  1. windowsensor, which will start the scene when a window is opened
  2. global variable for absence (in our case: PresentState)

In lines 8-12 you will find the small function, which defines a specific temperature for each zone (most people use one zone per room), when a window is opened (Link tutorial heatingplan)


The zone´s ID is apparent in the URL inside the web browser when you are working on the heatingplan for the specific zone

In line 14 and following you can see the exact same function, but this time in order to define a temperature for absence.

You need to sign in the ID of your windowsensor in line 19.


Afterwards a lot of script is following. Here links the FIBARO system with itself and pauses the heating. The IP, which occures in the script, adresses the local host.

From line 114 on, the script checks which trigger has started the scene. If it was the absence variable, the function above, which set the temperature for absence, will be select.

If this condition is not fulfilled, the script checks (line 131 and following), wether the scene is triggered by a windowsensor. Then the other function will be select and the defined temperature set.

In case you have two windows in one room, please use the following script:

This was a short article to a Lua-script fitting this time of the year. I hope it makes your life a bit smarter. If you have any ideas on how to develop the script even further, please leave a comment in the commentsection. Maybe a „holiday mode“? What should such a „holiday mode“ be capable of?

Here some additional icon suggestions for your new scene:

Icon-window-open-06 Icon-window-open-07


About The Author
Hi, I'm crissxcross, qualified IT system electronics. Professionally, I work as a product marketing manager in the Smart Home. And private I am self a Smart Homie :-) If I do not sit in front of the monitor like I photograph and am a big fan of Apple. I am the founder of the SiiO.de blog.

Leave a Response