Control thermostat using remote temperature sensor

Currently a work-in-progress, don’t use this until this notice is removed!!

Basing this off of Target temperature adjustment depending on second temperature sensor, from @nevesenin. My use case is to allow for conditional use of this automation (i.e., at the end of the day, I go into the master bedroom and shut the door, now I want the temperature sensor in my bedroom to control the main thermostat, until I wake up in the morning and exit the room).

blueprint:
  name: Control thermostat using remote temperature sensor
  description: >
    Basing this off of (https://community.home-assistant.io/t/target-temperature-adjustment-depending-on-second-temperature-sensor/297287), from @nevesenin. My use case is to allow for conditional use of this automation (i.e., at the end of the day, I go into the master bedroom and shut the door, now I want the temperature sensor in my bedroom to control the main thermostat, until I wake up in the morning and exit the room).
  domain: automation
  input:
    temperature_sensor:
      name: Temperature sensor
      description: This sensor will be used as the source.
      selector:
        entity:
          domain: sensor
          device_class: temperature
    thermostat:
      name: Thermostat
      description: The thermostat to set target temperature
      selector:
        entity:
          domain: climate
    trigger_sensors:
      name: Additional triggers
      description: Trigger an update on these additional trigger state changes.
      selector:
        entity:
          domain: sensor
    target_temperature:
      name: Target temperature
      description: Target temperature of the thermostat
      selector:
        number:
          min: 45
          max: 85
          step: 0.5
          unit_of_measurement: "°F"
      default: 72
          
variables:
  thermostat: !input thermostat
  temperature_sensor: !input temperature_sensor
  target_temperature: !input target_temperature
  actual_temperature: "{{ states(temperature_sensor) | float }}"
  calculated_adjustment: "{{ target_temperature - actual_temperature }}"
  calculated_target_temperature: "{{ ( ( ( target_temperature + calculated_adjustment ) * 2 ) | round ) / 2 }}"

trigger:
- platform: state
  entity_id: !input thermostat
  attribute: "{{ current_temperature_attribute }}"
- platform: state
  entity_id: !input temperature_sensor
  
condition: "{{ calculated_adjustment != 0 }}"

action:
- service: system_log.write
  data:
    message: >
      {{ thermostat }} has temp difference of {{ calculated_adjustment }}. Setting target temperature to {{ calculated_target_temperature }}
    level: info
    logger: blueprints.nevesenin.target_temperature_adjustment
- service: system_log.write
  data:
    message: >
      thermostat: {{ thermostat }},
      temperature_sensor: {{ temperature_sensor }},
      target_temperature: {{ target_temperature }},
      actual_temperature: {{ actual_temperature }},
      calculated_adjustment: {{ calculated_adjustment }},
      calculated_target_temperature: {{ calculated_target_temperature }}
    level: debug
    logger: blueprints.nevesenin.target_temperature_adjustment
- service: climate.set_temperature
  data:
    temperature: "{{ calculated_target_temperature }}"
    entity_id: "{{ thermostat }}"
mode: single
6 Likes

Anymore on this? Were you able to add a condition to not trigger it until some other sensor value?