Template not triggering (dare calculation)

Hello

I’ve been working on this quite a while, but cannot get the automation working.
I have a calendar, where I track my garbage collection, and it works like a charm. I even have a card showing the status of each of the garbage type my town handles.

Now I want to go one step further, I want it to notify in my mobile the day before, and that does not work.

This is my basic condition:
'{{ (( as_timestamp(state_attr(''calendar.braun'', ''start_time'')) - as_timestamp(now())) | timestamp_custom(''%d'') )|int <= 1 }} '
I’ve used it as a condition (with trigger at a fixed time) and as a trigger and it does not work (the template returns true when evaluated on the devs tools)

As of now my automation is:

- id: '1567616886630'
  alias: Orgánica (Braun)
  trigger:
  - platform: template
    value_template: '{{ (( as_timestamp(state_attr(''calendar.braun'', ''start_time''))  -  as_timestamp(now()))  | timestamp_custom(''%d'')  )|int <= 1 }} '
  condition: []
  action:
  - data:
      message: Sacar el orgánico (marrón) {{ as_timestamp(state_attr('calendar.braun',
        'start_time')) | timestamp_custom('%d.%m') }}
      title: Sacar la basura
    service: notify.mobile_app_alejandro_note

I call the notify part, and it works. I evaluate the template and returns true. Can anybody help me?

Thanks!

try this for the trigger value_template:

{% if (( as_timestamp(state_attr('calendar.braun', 'start_time'))  -  as_timestamp(now()))  | timestamp_custom('%d')  ) | int <= 1 %} true {% endif %}

That will only trigger when calendar.braun changes state. Which will most likely be the first time the calendar event gets created. It will never trigger anytime after that unless calendar.braun changes, which I doubt will ever happen again.

If you want that to trigger, you’ll need to use sensor.time instead of now(). Are you just trying to send a notification exactly 24 hours from the calendar date?