Automation trigger only when trigger.to_state.attribute actually changed?

Hi everybody,

last night, some climate entities mysteriously changed their current_heating_setpoint. I don’t know why, but also don’t know how to figure it out now that it happened >~ 10 hours ago.

Below is my automation. I also had current_heating_setpoint as an attribute for the platform: state, but that did not make a difference.

When I enable the automation, I get the image (below the automation). Why would it trigger when the trigger.to_state.attributes.current_heating_setpoint has not changed? Can you tell me how to modify my automation so that it will only then trigger, if any of those included entity_ids change to a different temperature?

Thank you in advance for your help :slight_smile:

alias: 1 VIP Heizungsalarm
description: 'wenn Heizungen die Temperatur ändern, melden!'
trigger:
  - platform: state
    entity_id:
      - climate.arbeitszimmer_heizung
      - climate.bad_oben
      - climate.bad_unten
      - climate.flur_unten
      - climate.jonna_heizung
      - climate.kueche_heizung
      - climate.wohnzimmer
      - climate.zwischenzimmer_heizung
condition: []
action:
  - service: notify.tg_me
    data:
      message: "\U0001F321 {{ trigger.to_state.name }} jetzt auf {{ trigger.to_state.attributes.current_heating_setpoint }}°C ."
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
      milliseconds: 0
mode: single

Because the trigger fires on every change of every state object for each of the listed entities. You need a condition that filters out the state changes you don’t want (or rather, allowlists the single state change that you do want)

This should do it, I think…

alias: 1 VIP Heizungsalarm
trigger:
  platform: state
  entity_id:
    - climate.arbeitszimmer_heizung
    - climate.bad_oben
    - climate.bad_unten
    - climate.flur_unten
    - climate.jonna_heizung
    - climate.kueche_heizung
    - climate.wohnzimmer
    - climate.zwischenzimmer_heizung
condition:
  - "{{ trigger.to_state.attributes.current_heating_setpoint != trigger.from_state.attributes.current_heating_setpoint }}" 
action:
  - service: notify.tg_me
    data:
      message: "\U0001F321 {{ trigger.to_state.name }} jetzt auf {{ trigger.to_state.attributes.current_heating_setpoint }}°C ."
  - delay:
      seconds: 3
2 Likes

Perfect, thank you :slight_smile:

1 Like