#Template sensor trigger from automation run

1 messages · Page 1 of 1 (latest)

limber sapphire
#

I have an automation that populates some todo lists. How would i setup my trigger in a template sensor to run after the automation has finished? Currently using timing to update the sensor but it runs into issues where the lists are half updated so the template sensor doesn't populate correctly because the automation is running at the same time.

tiny ridge
#

You could trigger on the current attribute of the automation going to a value of 0. Alternatively, you could fire an event that you could trigger on at the end.

limber sapphire
#

looking at 'current' didnt seem to work when i tested, let me try again..

#
- trigger:
    - platform: state
      entity_id:
        - automation.sync_calendar_to_todo_list
      attribute: current
      to:
        - "0"

yes?

tiny ridge
#

Don't use quotes

#

- 0

limber sapphire
#

not sure.. the only trigger that seems to work is time_pattern

#

eh nvm idk now it's just suddenly working on event 🤷

#

ty

tired tiger
#

what if you use the homeassistant.update_entity command at the end of your automation?

#

This should force the sensor to reevaluate I think

#

Or eventually, use custom event and trigger tempalte sensor on this event. Fire the event from the automation.

limber sapphire
#

that's what I ended up doing was just firing an event for it

#

and the sensor trigger watches it

vale sequoia
tiny ridge
#

Sure, either should be fine

#

It's just the wrong type since its an attribute

vale sequoia
#

An attribute can be a list

#

So if an attribute is used in a state trigger, it might check for a list with the specified value

#

Not sure though

tiny ridge
#

Yeah, that is interesting, wonder if that's how it's handled. Might be the case since OP seemed to imply they couldn't get it working

tiny ridge
#

Hmm, just gave it a shot and it doesn't seem like matching is handled different for state attribute triggers and state triggers.

#

For fun, I tried making a list of lists to get it to fire, but that blew up due to how the matching is implemented