Use trigger.id to set temperature for hvac

Hey

I’m playing around with an automation that would set my hvac to a different temperature when we are not at home and then put it back on when we are back home.

It looks like this right now:

alias: CLIMATE AWAY/HOME
description: Control hvac based on precense
trigger:
  - platform: state
    entity_id:
      - input_boolean.alarm_on
    to: "on"
    for:
      hours: 0
      minutes: 30
      seconds: 0
    id: "16"
  - platform: state
    entity_id:
      - input_boolean.alarm_on
    to: "off"
    for:
      hours: 0
      minutes: 2
      seconds: 0
    id: "20"
condition: []
action:
  - service: climate.set_temperature
    data:
      temperature: {{trigger.id}}
    target:
      entity_id: climate.luftvarmepump
mode: single

My issue is that the automation wont allow me to set the temperature to “{{trigger.id}}” but I use the “trigger.id” in a similar way when I want to control lights or similar.

Any ideas on how to do this properly?

I know i can do this easily with two different automations, but the idea is to use just one to make it “simple”.

Quote your single line templates:

    data:
      temperature: "{{trigger.id}}"
1 Like

I spoke to qucikly, new issue :slight_smile:

Stopped because an error was encountered at 4 oktober 2022 14:10:21 (runtime: 0.01 seconds)

expected float for dictionary value @ data[‘temperature’]

I feel like “16” or “18” should be good enough?

You will need to add a filter to convert it to a float:

data:
      temperature: "{{trigger.id | float(0) }}"