Automation does not trigger input_boolean

Hello,
I’m trying to define a template for automation to enable / disable between two dates and times. It is an automation to activate a conditional mode.
For this I have defined the time_date sensor:
sensor:

  • platform: time_date
    display_options:
    • ‘time’
    • ‘date’
    • ‘date_time’
    • ‘date_time_utc’
    • ‘date_time_iso’
    • ‘time_date’
    • ‘time_utc’
    • ‘beat’

The imput_boolean:

input_boolean:
futbol_match:
name: “Futbol Match”
initial: off

And finally the imput_datetime

input_datetime:
futbol_match_on:
name: Match On
has_date: true
has_time: true
futbol_match_off:
name: Match Off
has_date: true
has_time: true

And in automation, I’m trying to use this formula, but it doesn’t work. I can’t find the formula to automatically turn it on and off. Can you help me, please? Thank you

‘{{ states(’‘sensor.date_time’’) == (state_attr(’‘input_datetime.futbol_match_on’’,
‘‘timestamp’’) | int | timestamp_custom(’’%H:%M’’, True)) }}’

and this automation

  • id: ‘Match On’
    alias: Match On
    description: ‘’
    trigger:
    • platform: template
      value_template: ‘{{ states(’‘sensor.date_time’’) == (state_attr(’‘input_datetime.futbol_match_on’’,
      ‘‘timestamp’’) | int | timestamp_custom(’’%H:%M’’, True)) }}’
      condition: []
      action:
    • data: {}
      entity_id: input_boolean.futbol_match
      service: input_boolean.turn_on

First you need to format your code properly for display in the forum. If you don’t we can’t see any syntax errors in the code. put three back ticks (```) before and after your code sections.