Rollershutter Automation (shading calculated instead of using sensors for each window)


Since I could not find anything that would meet my requirements, I wrote a Jython script with the following features:

  • calendar: specifies the daily schedule that is to be run on a particular day.
  • daily schedule: e.g. “workday” “weekend” “vacation”. It defines the rules that are to be run a particular type of day.
  • rule: defines the time/trigger and action to be run on which rollershutter.
  • shading logic: create a shading model for each rollershutter and then have the script calculate if it is currently sunlit or not. (using the astro binding). Autoclose the rollershutter when window is sunlit.
  • weather / sun sensor awareness: include info from weather binding and / or a sun sensor
  • master automation ON/OFF switch
  • entirely configured through yaml

I created a github repo with the code, installation instructions and a very simple openhab2 config as demo and for testing.

It is not optimised in any way and there might have been better ways to achieve the same result. But I wanted to have a working solution quickly.

I found it rather difficult to get started with openhab2 and Jython. I guess I’m not the only one, so you may find this script helpful as an example even if rollershutters are not of interest to you.


Thank you, this is amazingly helpful as I got my rollershutters included into OH literally just this week and was playing around with automation rules :smile:

1 Like

Interesting. Up until a few weeks ago I was using a Tahoma box myself. It is exactly that box I wanted to get rid of since I wanted more control over my rollershutters. But if I understand your posts correctly you are using it merely as communication tool, ignoring its automation features, right?

Yes, just the communication, the automation features of that thing are not worth discussing :angry:

My main reason is that I could not configure the rfxcom sender, so in the end I just gave up and bought the Tahoma after seeing that @Ondrej_Pecta hat written a nice binding for it. Now, my family is just happy that the rollershutters “just work”

Hi @schnidrig, thanks for your great work!!

I am testing your script with one of my shutters. Going up in den morning and down in the evening is working fine. But the shutter is not closing when the sun hits the window.

The calculation seems to work, but the script does not close the shutter.


2018-07-01 07:53:36.221 [INFO ] [jython.shutters.SunExposureRule     ] - Rollo_WC isSunlit: True
2018-07-01 07:53:36.234 [INFO ] [jython.shutters.SunExposureRule     ] - Auto(ON): sending command: Rollo_WC=STOP
2018-07-01 14:26:36.121 [INFO ] [jython.shutters.SunExposureRule     ] - Rollo_WC isSunlit: False
2018-07-01 14:26:36.132 [INFO ] [jython.shutters.SunExposureRule     ] - Auto(ON): sending command: Rollo_WC=UP


2018-07-01 07:53:36.251 [ome.event.ItemCommandEvent] - Item 'Rollo_WC' received command STOP
2018-07-01 07:53:36.276 [vent.ItemStateChangedEvent] - state_sunlit_Rollo_WC changed from False to True
2018-07-01 14:26:36.147 [ome.event.ItemCommandEvent] - Item 'Rollo_WC' received command UP
2018-07-01 14:26:36.183 [vent.ItemStateChangedEvent] - state_sunlit_Rollo_WC changed from True to False


    orientation: 135
      - azimuth: 78
      - azimuth: 204

Hi @sfrechen

My shutters (Somfy) travel to a previously saved position when I send the command “STOP”. By default that position is shutters almost closed but letting just a bit daylight in. Exactly what I need during the day when the sun shines.
This may be different with your shutters. If that is the case you would have to send a DOWN command instead of STOP.

1 Like

I am using Homematic shutters (HM-LC-Bl1PBU-FM). It is possible to send them to a specific position by defining a % value.

So i changed:

if sunlitState == sunlitStateFalse:
                            self.sendCommand(shutterName, "STOP", auto)
                            events.postUpdate(prefix_sunlit + shutterName, sunlitStateTrue)


if sunlitState == sunlitStateFalse:
                            self.sendCommand(shutterName, "35", auto)
                            events.postUpdate(prefix_sunlit + shutterName, sunlitStateTrue)

It seems to work. The shutter went to 35% this morning… :+1: