Skip to content

Instantly share code, notes, and snippets.

@sotatech
Last active September 25, 2021 10:48
Show Gist options
  • Save sotatech/471227449197b5a296394399aee511af to your computer and use it in GitHub Desktop.
Save sotatech/471227449197b5a296394399aee511af to your computer and use it in GitHub Desktop.
Notify HomeMatic if a door is open.
blueprint:
name: Door Open, Notify HomeMatic CCU
description: An automation blueprint that reduces the set temperature of your climate
device or group if a door 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:
door_entity:
name: Door Sensor
description: The door sensor that will control the climate entity.
selector:
entity:
domain: binary_sensor
device_class: door
open_delay:
name: Door Open Wait Time
description: Time to delay after door 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 door sensor.
selector:
entity:
domain: climate
source_url: https://gist.github.com/sotatech/471227449197b5a296394399aee511af
variables:
blocking_entity: !input blocking_entity
climate_target: !input climate_entity
climate_id: '{{ state_attr( climate_target, "id") }}'
open_delay: !input open_delay
trigger:
- platform: state
entity_id: !input 'door_entity'
to: 'on'
for: !input 'open_delay'
condition:
- condition: template
value_template: "{{ (blocking_entity == none) or (states[blocking_entity].state == 'off') }}"
action:
- service: homematic.set_device_value
data:
address: "{{ climate_id }}"
channel: 1
param: 'WINDOW_STATE'
value: 1
- wait_for_trigger:
- platform: state
entity_id: !input 'door_entity'
to: 'off'
continue_on_timeout: false
- service: homematic.set_device_value
data:
address: "{{ climate_id }}"
channel: 1
param: 'WINDOW_STATE'
value: 0
mode: restart
max_exceeded: silent
@sotatech
Copy link
Author

Added blocking entity option. I use this with a summer_heating_mode helper to stop the automation running during the summer when it's not needed. Hopefully thus saving on batteries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment