Homematic IP Local - Bind a custom Window sensor to thermostat

I made modified version of sota’s blueprint:

Many thanks for this.

My blueprint is working with the homematic ip local addon for the CCU. With this you are able to bind any binary_sensor to an homematic ip thermostat.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  name: Window Open, Notify HomeMatic IP Local CCU
  description:
    An automation blueprint that reduces the set temperature of your climate
    device or group if a window sensor is open for more than the preset wait time.
    It uses the Homematic window sensor channel to set the temperature to the "Open-window
    temperature" set in the device configuration. You should set the "Mode for temperature
    fall detection" to Inactive to avoid conflicts. It waits until the window is closed
    again in order to restore the climate entity temperature. It has an optional blocking
    entity to prevent the automation running unnecessarily, for example during the
    Summer season.
  domain: automation
  input:
    window_entity:
      name: Window Sensor
      description: The window sensor that will control the climate entity.
      selector:
        entity:
          domain: binary_sensor
          multiple: false
    open_delay:
      name: Windows Open Wait Time
      description: Time to delay after window opens before notifying HomeMatic.
      default: 30
      selector:
        number:
          min: 0.0
          max: 600.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0
    blocking_entity:
      name: (OPTIONAL) Blocking Entity
      description:
        If this entity's state is off, it will prevent the automation from
        running. E.g. summer mode or away mode.
      default:
      selector:
        entity:
          domain: input_boolean
          multiple: false
    climate_entity:
      name: Climate Device
      description: The climate entity that is controlled by the window sensor.
      selector:
        entity:
          domain: climate
          multiple: false
  #source_url: https://gist.github.com/smoki3/9e38e03d6ae180326ab1c80282ec6d78
  #based on: https://gist.github.com/sotatech/500b53ee64ca5ad5299c22cde47407ed
variables:
  blocking_entity: !input blocking_entity
  climate_target: !input climate_entity
  climate_id: "{{ device_id(climate_target) }}"
  open_delay: !input open_delay
trigger:
  - platform: state
    entity_id: !input window_entity
    to: "on"
    for: !input open_delay
condition:
  - condition: template
    value_template:
      "{{ (blocking_entity == none) or (states[blocking_entity].state
      == 'on') }}"
action:
  - service: homematicip_local.set_device_value
    data:
      device_id: "{{ climate_id }}"
      channel: 1
      parameter: WINDOW_STATE
      value: "1"
      value_type: int
  - wait_for_trigger:
      - platform: state
        entity_id: !input window_entity
        to: "off"
    continue_on_timeout: false
  - service: homematicip_local.set_device_value
    data:
      device_id: "{{ climate_id }}"
      channel: 1
      parameter: WINDOW_STATE
      value: "0"
      value_type: int
mode: restart
max_exceeded: silent

Hello,
should i connect this blueprint with the Homematic Heating group, or the wall thermostat in this heating group?

If set to heating group. Temp goes down, but no window open icon on the wall thermostat.
If set to wall thermostat, the icon is shown, but temp does not go down.

Also is there a way to prevent manual increase the temp after the window was opened?

I use HomeMatic Groups and it works fine - the temperature is changed and the open window icon appears on the thermostat. If you look on the CCU does the setting change there?

I recomment to connect the blueprint to the heating group.

The window open symbol appears on then on all devices in this group. (thermostat and wall thermostat)

You have to be patient. Homematic IP took some time to sent the commands to all devices. So try to open the window an wait 2 min. Then look in the CCU if the command has been sent so all devices without any error.

Thank you for the blueprint, works for me with aqara zigbee sensors.

Is it possible to set a delay after the window is closed, so the thermostat won’t set itself back after a few seconds?

My homematic ip thermostat usually waits a few minutes (because without window sensor, he probably has a fixed time when the “window open” has triggered)

I would like to set it to something like 3-4 Minutes, because after i ventilate my flat i would like to wait for the thermostat to adjust to the new room temperature, rather than setting itself back to like 22°C after he got 4°C cold air.

1 Like

in the actual blueprint it is hardcoded with 5 seconds:


  - wait_for_trigger:
      - platform: state
        entity_id: !input window_entity
        to: "off"
        for: 5

But I can implement also a slider for this

@onimoschta
I just pushed a new version. So could you please test if it is working?

1 Like

Yes, after examining the code (im not really good with programming) i changed the 5 seconds manually, but your change with the slider works great! thank you.

After using this now for about 3 months i sometimes get a thermostat stuck in “window open” state.
Did you or somebody else also experience this?
It happens really rarely and i think it happens because of the internal “window_state open” within the thermostat itself, triggered by a slow drop in temperature (opening a window).
When the window is closed and the blueprint state change is about to happen while the thermostat internal state-change is about to trigger “window open”, it probably causes this problem. Usually it should revert back in about 10 minutes as if you had no window sensors, but it does not.
I had it a few times, only locally switching from auto to manual and back will resolve the issue (hope my explanation was somewhat understandable).