Automations EvoHome - Merge into one Automation

Hi All, been around one month now and I would like to Merge all my single Automation into one, I like a Clean dash, plus this should work so I can change it quickly.

So far I have the following:

platform: state
entity_id: climate.hall,climate.play_room,.....
attribute: preset_modes
to: temporary

---
entity_id: trigger.entity_id # I think this is wrong, I have tired with '' and {{}} nothing works.
setpoint: >-
  {{ state_attr(trigger.entity_id,
  'status').setpoint_status.target_heat_temperature }}
duration:
  minutes: 60

I tried to run this in a template but triggers are not support, so fair I get getting, I have another action to ping me a message if it works, but nothing for this.

I would like the Action to check what the trigger and found and run based on that, I think this should be possible but I feel like I am missing something really simple, could someone point me in the right direction?

Thanks all.

Close, you need trigger.to_state or trigger.from_state

trigger.to_state.entity_id
{{ state_attr(trigger.to_state.entity_id, 'status')

dam it, thank you for your help :slight_smile:

Interestingly, the documentation for State Trigger indicates trigger.entity_id is valid.

STATE

Template variable Data
trigger.platform Hardcoded: state
trigger.entity_id Entity ID that we observe.
trigger.from_state The previous state object of the entity.
trigger.to_state The new state object that triggered trigger.
trigger.for Timedelta object how long state has been to state, if any.

This line:

entity_id: trigger.entity_id

should be a template:

entity_id: '{{ trigger.entity_id }}'

But if you tried all of that and it still failed then it implies the documentation is incorrect.

Ha, as I typed that I was thinking "why wouldn’t trigger.entity_id be valid? It would be the same for both state objects…so would be useful to know outside, especially for those cases where to_state or from_state aren’t valid.

You’re right, it was probably just the lack of template. The syntax he has posted there is pretty alien to me. What is ‘setpoint’? I just thought this was some GUI automation, or some device trigger…both of which I’ve never used.

Typically I solved it before testing, same issue So I have removed it from the automation to check that the trigger is being set, but this is now falling…

regarding setpoint, this is to use to set the temperature using the thermostat dial, I use this to stop the wife putting on the heating for 7 hours a day…

Thanks for the updates all, will try so more testing and update once i work out what causing the issue :slight_smile:
Thanks

Oh, I see. the "---" is probably a gap in the automation where you left things out. That makes sense.

You are setting the entity_id in the data section I assume (since it’s at the same indentation as setpoint).

The climate page says to use ‘temperature’ though…

service: climate.set_temperature
data:
  entity_id: "{{ trigger.entity_id }}"
  temperature: "{{ state_attr(trigger.entity_id, 'status').setpoint_status.target_heat_temperature }}"

Also, are you sure that status attribute has those values for all of your climate devices?

condition: 
  - >
    "{% set status = state_attr(trigger.entity_id, 'status') %}
     {{ status and status.setpoint_status is defined }}

A passive-aggressive automation.

Good luck with that strategy.

it already works :slight_smile: but would like it in one task so I can keep an eye on it all :slight_smile:

Yes, as I have it working on single tasks and this works fine, thanks again

I have the impression you may have misunderstood the meaning of my previous comment. I wasn’t referring to the automation’s technical aspects but to the rationale of overruling a loved one’s preferences.