Problems with trigger variable in targets

I posted a different version of the datetime template just to show there’s another way to do the same thing.

I tried the code but unfortunately it doesn‘t work at all. None of the timedate inputs are filled :frowning:

How did you test the automation? Did device_tracker.doris_iphone_2 move from one zone to another?

Yep. In real life :open_mouth:

First, confirm the automation was triggered. Go to Configuration > Automations and look at the date next to automation.doris_enter. If the date and time corresponds with when you tested it, then it was triggered. Now you need to discover why it failed to set the input_datetime.

Check Configuration > Logs for any messages related to the automation’s execution.

If there are no error messages (or even if there are), add an id option with a unique value to the automation. Something like this:

- alias: doris_enter
  id: doris_enter_testing
  trigger:

Reload Automations then repeat your tests. Now Home Assistant will produce a trace each time the automation is triggered (because the automation has an id). Examine the traces and they will reveal the values used within the service call.

To see an automation’s traces, click the second icon next to its name.

It ran but no logs due to reboot.
I will set an id and check tomorrow.

It seems the trigger_id isn’t given to the input_datetime:

Executed: 10. September 2021, 9:41:35

Error: Template rendered invalid entity IDs: input_datetime.doris_

Any idea why?

Only reasons I can think of is if you are using a version of Home Assistant older than 2021.7.0 (which was the first release to support named trigger identifiers) or if you execute the automation manually because then the trigger variable is undefined.

If you are using a recent version and not executing it manually, I don’t know why trigger.id fails to produce a value.

I am using core-2021.9.5 …

What do you mean with manually? Actually the trigger fired when the iPhone entered the zone.

You’re using the latest version of Home Assistant and the automation was triggered by its trigger (as opposed to being manually executed using Run Actions or via the automation.trigger service call). Those are the only two reasons I know of, that would prevent trigger.id from producing a value, aren’t the cause of the failure. :man_shrugging:

I got my mistake :see_no_evil: I typed trigger_id instead of trigger.id …

I think we’re done here.

1 Like

Yes. Thank you so much!
Sometimes it is really weird. I was looking again and again to the code and I didn’t find anything and then suddenly I thought for myself, this can’t be right …