Skip to content

Instantly share code, notes, and snippets.

@iceteabottle
Last active February 18, 2024 21:00
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 iceteabottle/be92e93904986e5871a8d43356aff677 to your computer and use it in GitHub Desktop.
Save iceteabottle/be92e93904986e5871a8d43356aff677 to your computer and use it in GitHub Desktop.
Bosch Thermostat Blueprint #home-assistant
blueprint:
name: Bosch Thermostat
author: iceteabottle
description: "
# Automation especially for the Bosch Thermostat II ([BTH-RA](https://www.zigbee2mqtt.io/devices/BTH-RA.html#bosch-bth-ra))
## Core Features
- Switch the TRV on/off depending on a window sensor
- Sync the value of the temperature sensor to the TRV's internal `remote_temperature` entity (there's no need to calibrate it manually via `local_temperature_calibration`)
- Based on a weather entity and a winter temperature the TRV will be switched off to avoid heating in the summer
## References
- [Smart Thermostat](https://gist.github.com/AlexanderBabel/69c3b996a66b3a132cafadcbac4140cc)
- [Advanced Heating Control](https://github.com/panhans/homeassistant/blob/main/blueprints/automation/panhans/heating_control.yaml)
## Notes
- Maybe this blueprint works also for other TRVs. The required entity of the TRV: `remote_temperature`
## Help
[Automate your Bosch Thermostat 2](https://community.home-assistant.io/t/automate-your-bosch-thermostat-2/675636)
"
domain: automation
source_url: https://gist.github.com/iceteabottle/be92e93904986e5871a8d43356aff677
input:
thermostat:
name: Thermostat
description: "The TRV needs to have the following entity: `remote_temperature`"
selector:
entity:
multiple: false
filter:
- domain: climate
window_sensor:
name: Window/door sensor (or group)
selector:
entity:
multiple: false
filter:
- domain: binary_sensor
window_delay:
name: Window/door sensor delay
description: Time the sensor needs to stay the same after change to trigger
the automation. This is done to avoid retriggering. (Default = 5s)
default: 5
selector:
number:
mode: box
min: 0.0
max: 3600.0
unit_of_measurement: seconds
step: 1.0
temperature_sensor:
name: Temperature sensor
selector:
entity:
multiple: false
filter:
- domain: sensor
device_class: temperature
weather:
name: Weather
description: Specify your weather to get the current outside temperature from.
selector:
entity:
domain: weather
multiple: false
wintermode:
name: Wintermode
description: The ouside temperature needs to be below this to activate wintermode.
(Default = 16°C)
default: 16
selector:
number:
step: 0.5
min: 0.0
max: 150.0
unit_of_measurement: °C or °F
mode: slider
wintermode_delay:
name: Wintermode Delay
description: Time the outside temperature neeeds to stay above the wintermode
temperature to turn the heating off.
default: 30
selector:
number:
mode: box
min: 1.0
max: 86400.0
unit_of_measurement: minutes
step: 1.0
trigger:
- platform: state
entity_id: !input window_sensor
to: 'off'
from: 'on'
for: !input window_delay
- platform: state
entity_id: !input window_sensor
to: 'on'
from: 'off'
for: !input window_delay
- platform: state
entity_id: !input temperature_sensor
- platform: numeric_state
entity_id: !input weather
attribute: temperature
below: !input wintermode
for: !input wintermode_delay
- platform: numeric_state
entity_id: !input weather
attribute: temperature
above: !input wintermode
for: !input wintermode_delay
- platform: time_pattern
minutes: '29'
variables:
trv: !input thermostat
remote_temperature_entity: >
{% set entities = device_entities(device_id(trv)) %}
{% set remote_temperature_entity_id = namespace(id=[]) %}
{% for s in entities %}
{% if ('remote_temperature' in s) %}
{% set remote_temperature_entity_id.id = s %}
{% endif %}
{% endfor %}
{{ iif (remote_temperature_entity_id.id[0] is defined, remote_temperature_entity_id.id, '') }}
current_temperature: !input temperature_sensor
action:
# window sensor handling
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: !input window_sensor
state: 'on'
- condition: numeric_state
entity_id: !input weather
attribute: temperature
above: !input wintermode
sequence:
- service: climate.set_hvac_mode
data:
hvac_mode: 'off'
entity_id: !input thermostat
- conditions:
- condition: and
conditions:
- condition: state
entity_id: !input window_sensor
state: 'off'
- condition: numeric_state
entity_id: !input weather
attribute: temperature
below: !input wintermode
sequence:
- service: climate.set_hvac_mode
data:
hvac_mode: 'heat'
entity_id: !input thermostat
# temperature sensor sync
- service: number.set_value
data:
value: "{{ states(current_temperature) | float }}"
target:
entity_id: "{{ remote_temperature_entity }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment