Skip to content

Instantly share code, notes, and snippets.

@jpf91
Last active October 7, 2023 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpf91/6d7bcc34532e4025c0ff83d77aeac084 to your computer and use it in GitHub Desktop.
Save jpf91/6d7bcc34532e4025c0ff83d77aeac084 to your computer and use it in GitHub Desktop.
blueprint:
name: Window Open, Notify HomeMatic 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: true
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 on, it will prevent the automation from
running. E.g. summer mode or away mode.
default:
selector:
entity:
domain: input_boolean
climate_entity:
name: Climate Device
description: The climate entity that is controlled by the window sensor.
selector:
device:
integration: homematicip_local
source_url: https://community.home-assistant.io/t/homematic-ip-local-reduce-room-temperature-when-a-window-or-door-is-opened/373305
variables:
blocking_entity: !input "blocking_entity"
climate_target: !input "climate_entity"
climate_id: !input "climate_entity"
open_delay: !input "open_delay"
windows: !input "window_entity"
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 == 'off') }}"
action:
- service: homematicip_local.set_device_value
data:
device_id: "{{ climate_id }}"
channel: 1
parameter: WINDOW_STATE
value: 1
- wait_template: >
{% set closed = namespace(bool=true) %}
{% for state in states.binary_sensor%}
{% if state.entity_id in windows %}
{% if state.state == "on" %}
{% set closed.bool = false %}
{% endif %}
{% endif %}
{% endfor %}
{{closed.bool}}
continue_on_timeout: false
- service: homematicip_local.set_device_value
data:
device_id: "{{ climate_id }}"
channel: 1
parameter: WINDOW_STATE
value: 0
mode: restart
max_exceeded: silent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment