Comparing two temperatures to turn thermostat on/off

Hi,

I’m trying to use my Smart TRV’s to actuate my Nest off/on. I’m aware I can only do this by turning the temperature of the nest up/down. Here’s what I have

alias: Automation Check on
description: "Automation Check. Checks All TRV's, if they are set to above the current registered temperature, set Main thermo to 32 (i.e. on)"
trigger:
  - platform: numeric_state
    entity_id: climate.bathroom_thermostat
    attribute: temperature
    above: current_temperature
  - platform: numeric_state
    entity_id: climate.bedroom_thermostat
    attribute: temperature
    above: current_temperature
  - platform: numeric_state
    entity_id: climate.kitchen_thermostat
    attribute: temperature
    above: current_temperature
  - platform: numeric_state
    entity_id: climate.nursery_thermostat
    attribute: temperature
    above: current_temperature
  - platform: numeric_state
    entity_id: climate.living_room_table
    attribute: temperature
    above: current_temperature
  - platform: numeric_state
    entity_id: climate.living_room_sofa
    attribute: temperature
    above: current_temperature
  - platform: numeric_state
    entity_id: climate.study_thermostat
    attribute: temperature
    above: current_temperature
condition: []
action:
  - service: climate.set_temperature
    data:
      temperature: 32
    target:
      entity_id: climate.living_room
mode: single

But when I got to save it, I get the error:
Message malformed: expected float for dictionary value @ data['above']

So my question is, is there a way to use a reported temperature value (from the TRV sensor) to compare against and trigger the action?

Message is quite clear “current_temperature” is some text…Not a float…
You should set your temperature sensor entity not just “current_temperature” :man_shrugging:

Thanks, I appreciate you responding. I’ve tried using current_temperature.bathroom_thermostat, but that gives the same error. What syntax should I use to set the entity?

I apologise if this all seems really obvious, this is my first time with home assistant so still trying to understand the language.

If it’s helpful context, what I’m trying to do is be able to set individual radiator temperatures at the knob, and have them turn on the nest. That’s why I can’t just set a number, because the number may change, but I want it to react to the set number being higher than the registered number. Thanks again, I really appreciate any help.

instead of comparing the temperature from your climate to your “current_temperature” Wich is not a thing in home assistant. You have to compare to a temperature sensor. That’s all I can say. If you have such sensors…

Thanks, but I was able to get some help over on the discord. The current_temperature was the name of the attribute I wanted to compare to, so I guess it is a thing in home assistant, or it was brought by the Tuya integration. If it’s of interest to you for the future, this is where I got to and it’s now working (I have another automation that does the opposite to turn the main thermo off):

alias: Heat Automation - On
description: ""
trigger:
  - platform: template
    value_template: >-
      {{ state_attr('climate.bathroom_thermostat', 'temperature') | int >
      state_attr('climate.bathroom_thermostat', 'current_temperature') | int }}
  - platform: template
    value_template: >-
      {{ state_attr('climate.nursery_thermostat', 'temperature') | int >
      state_attr('climate.nursery_thermostat', 'current_temperature') | int }}
  - platform: template
    value_template: >-
      {{ state_attr('climate.kitchen_thermostat', 'temperature') | int >
      state_attr('climate.kitchen_thermostat', 'current_temperature') | int }}
  - platform: template
    value_template: >-
      {{ state_attr('climate.bedroom_thermostat', 'temperature') | int >
      state_attr('climate.bedroom_thermostat', 'current_temperature') | int }}
  - platform: template
    value_template: >-
      {{ state_attr('climate.living_room_sofa', 'temperature') | int >
      state_attr('climate.living_room_sofa', 'current_temperature') | int }}
  - platform: template
    value_template: >-
      {{ state_attr('climate.living_room_table', 'temperature') | int >
      state_attr('climate.living_room_table', 'current_temperature') | int }}
  - platform: template
    value_template: >-
      {{ state_attr('climate.study_thermostat', 'temperature') | int >
      state_attr('climate.study_thermostat', 'current_temperature') | int }}
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: climate.set_temperature
    data:
      temperature: 31
    target:
      entity_id: climate.living_room
mode: single

It’s a bit scrappy, and I think I can probably lose some of the titles, but it’s working. I’m going to set up a scheduler then I’ll go back and clean it up, before sharing it as a blueprint.

2 Likes