Automation on fixed month's day gives an error

Hi there, I’m trying to set up an automation which triggers every month on the day 10. This is the yaml configuration:

- id: '1604171942874'
  alias: memo ck
  description: ''
  trigger:
  - platform: template
    value_template: {{ ((as_timestamp(now())|int)|timestamp_custom("%d")) == "10" and ((as_timestamp(now())|int)|timestamp_custom("%H:%M")) == "20:00" }}
  condition: []
  action:
  - service: notify.telegram_federico
    data:
      message: perform ck
  mode: single`

But I get following error on log:
Error doing job: Exception in callback async_track_utc_time_change..pattern_time_change_listener()
Can anyone help me?
Thank you,
Federico

You can’t use now() in the trigger like that

What you can do is a time trigger, and a template condition to check that it’s the 10th day. In the condition you can use now().

With the latest relase, now() in templates is evaluated every minute if nothing else in the template changes. Does this not apply to template triggers?

Why make such a complicated template instead of something like:

"{{ now().day == 10 and now().hour == 20 and now().minute == 0 }}"

Well many thanks to both of you for the fast answers. You will probably have understood that I’m not at easy at all with the use of templates (by the way in case you had a suggestion about a link where I could start learning something I would be grateful). As a matter of fact I started searching for a solution which would trigger an automation every 20 days but in the end I had to give it up due to my poor knowledge and tried for something easier which was a trigger every month on the same day, and although I agree that Burningstone’s template is much simpler and even elegant I must say that my proposed solution appeared to have no problem on the developer’s test bench. But anyway the main problem seems to be what Tinkerer mentioned, so his answer will be considered the correct one although then I used the first part of the template suggested by Burningstone in the condition.

Again many thanks,

Federico

At this time, I don’t know, and I haven’t tested. I’d like to say yes, but until somebody confirms it…

I guess the question is then - what version of HA is the OP on? V117 or something earlier?