Climate entity to change target temperature when target temp is too high

Hi, I have some Bosch heating controls added to my HA implementation. What I want to acchieve is: When someone selects a target temperature that is higher than for example 23°C, it should change the target temp. back to 23°C. What I currently have is:

- id: '1606197808151'
  alias: temperature-above_limit
  trigger:
  - above: '23'
    entity_id: climate.wohnzimmer_kg2
    attribute: target_temp_high
    platform: numeric_state
  action:
  - service: climate.set_temperature
    target:
      entity_id:
      - climate.wohnzimmer_kg2
    data:
      temperature: 23
      target_temp_high: 23
      target_temp_low: 21

My problem is, that the automation is not triggered. I can change the target value of the climate control to a high value but nothing happens.

Any hint what I did wrong?

BR
Christoph

Why not use a thermostat and give it a range, that can’t be exceeded?

climate:
  - platform: generic_thermostat
    name: Study
    heater: switch.study_heater
    target_sensor: sensor.study_temperature
    min_temp: 15
    max_temp: 23
    ac_mode: false
    target_temp: 21
    cold_tolerance: 0.3
    hot_tolerance: 0
    min_cycle_duration:
      seconds: 5
    keep_alive:
      minutes: 3
    initial_hvac_mode: "off"
    away_temp: 16
    precision: 0.1

As an example. Here no one can go higher, then 23

Are you using heat-cool mode? IIRC, the target_temp_high and target_temp_low attributes are only used for heat-cool mode, if you are using a standard cool mode the attribute you should be monitioring with your trigger is temperature.

If you are using heat-cool mode then you should not be using/setting the temperature variable.

The problem is, that at the apartment the users can control the temp. by using the Bosch device that is mounted there. I can’t set a max number on that Bosch devices. But what I can do is, to check on HA if the temp. that has been set is exeeding a defined value and if it is, to set the value to a lower value.

Therefore I have to check by trigger if the target temp has been changed. If so, I have to check wether it is within a defined range. If not, decrease the value.

BR
C

Can you post a screen shot or copy/paste the details from the States tool for the climate entity in question?

These are the attributes:

hvac_modes: heat, auto
min_temp: 5
max_temp: 30
current_temperature: 23.6
temperature: 21
hvac_action: idle
setpoint: manual
bosch_state: idle
friendly_name: Heizung KG2
supported_features: 1

my automation look slike this:

- id: '1606197808151'
  alias: KG2 Temperature above limit
  trigger:
  - above: 20
    entity_id: climate.wohnzimmer_kg2
    attribute: temperature
    platform: numeric_state
    for:
      hours: 0
      minutes: 0
      seconds: 0
  action:
  - service: climate.set_temperature
    target:
      entity_id:
      - climate.wohnzimmer_kg2
    data:
      temperature: 18
      target_temp_high: 18
      target_temp_low: 17
  mode: parallel
  max: 10

As you can see the “temperature” attribute is currently set to 21. Allthough the trigger limit is 20 the trigger is not firing.

Any idead why?

BR
C

You are trying to set values that are not usable in your situation.

In your automation action you try to set the target_temp_high and target_temp_low values… which will crash your automation in this case. Those two values are only applicable to climate devices that are using the heat_cool mode.

So your automation should look more like:

- id: '1606197808151'
  alias: KG2 Temperature above limit
  trigger:
  - above: 20
    entity_id: climate.wohnzimmer_kg2
    attribute: temperature
    platform: numeric_state
    for: "00:00:01"
  action:
  - service: climate.set_temperature
    target:
      entity_id:
      - climate.wohnzimmer_kg2
    data:
      hvac_mode: auto
      temperature: 18
  mode: single

Keep in mind that State triggers require the state to change to make this automation run. If the temperature setting is already above 20 when you update the automation, it will not trigger unless the temperature setting is changed to below 20 then above 20… there are methods available to make automations more resilient.

You may want to extend the for: value of the trigger. Defining a for: value can help “debounce” a trigger so that there’s no need to use a parallel or queued mode. In your case it might also help because the person physically changing the temperature setting will walk away from the thermostat…

Thank you. Working now. BR C

A little advice here.
Place a delay first in the actions of 30 seconds or something.
That way the temperature csn be set to 30 degrees but when they stop looking it’s set down to 23 or what your number was.

This will make them not realize it and not try and fight it.