Last active
August 29, 2026 12:03
-
-
Save Fredyy90/b237c98d960c3a83601ba98fe2af57cd to your computer and use it in GitHub Desktop.
Window Open, Notify HomeMatic CCU - using homematicip_local
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: Window Open, Notify HomeMatic CCU - using homematicip_local | |
| 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. | |
| The automation reconciles the device state on every trigger, including after a | |
| Home Assistant restart or a reload of the homematicip_local integration, so the | |
| WINDOW_STATE of the device always matches the current window sensor state. | |
| 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 | |
| device_class: | |
| - window | |
| 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 | |
| startup_delay: | |
| name: Startup Sync Spread | |
| description: > | |
| After a restart, wait a random amount of time (0 to this value) before | |
| writing to the device. Spreads radio traffic so many rooms don't hit the | |
| CCU duty cycle at once. Set to 0 to disable. | |
| default: 60 | |
| 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 on, 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/Fredyy90/b237c98d960c3a83601ba98fe2af57cd | |
| variables: | |
| blocking_entity: !input blocking_entity | |
| climate_target: !input climate_entity | |
| window_target: !input window_entity | |
| startup_delay: !input startup_delay | |
| trigger: | |
| # Window opened long enough -> tell the CCU | |
| - platform: state | |
| entity_id: !input window_entity | |
| to: 'on' | |
| for: !input open_delay | |
| id: window | |
| # Window closed -> tell the CCU immediately, no delay | |
| - platform: state | |
| entity_id: !input window_entity | |
| to: 'off' | |
| id: window | |
| # Home Assistant (re)started -> reconcile whatever the current state is | |
| - platform: homeassistant | |
| event: start | |
| id: sync | |
| # homematicip_local reloaded / device came back -> reconcile as well | |
| - platform: state | |
| entity_id: !input climate_entity | |
| from: unavailable | |
| id: sync | |
| condition: [] | |
| action: | |
| # On a sync trigger, wait until the integration is actually up before touching it | |
| - choose: | |
| - conditions: | |
| - condition: trigger | |
| id: sync | |
| sequence: | |
| - wait_template: > | |
| {{ has_value(climate_target) | |
| and has_value(window_target) | |
| and state_attr(climate_target, 'address') is not none }} | |
| timeout: '00:10:00' | |
| continue_on_timeout: false | |
| - delay: | |
| seconds: '{{ range(0, (startup_delay | int(0)) + 1) | random }}' | |
| # Resolve everything only now, when the entities are known to be available | |
| - variables: | |
| channel_address: '{{ state_attr(climate_target, "address") }}' | |
| window_open: '{{ is_state(window_target, "on") }}' | |
| blocked: '{{ blocking_entity is not none and is_state(blocking_entity, "on") }}' | |
| - condition: template | |
| value_template: '{{ channel_address is not none }}' | |
| # Nothing to do if we're blocked and the window is shut anyway | |
| - condition: template | |
| value_template: '{{ not (blocked and not window_open) }}' | |
| - service: homematicip_local.set_device_value | |
| data: | |
| device_address: '{{ channel_address.split(":")[0] }}' | |
| channel: 1 | |
| parameter: WINDOW_STATE | |
| value: '{{ 1 if (window_open and not blocked) else 0 }}' | |
| mode: restart | |
| max_exceeded: silent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment