Greeting entry to the home - problem


 jarvis_greeting:
    sequence:
    - service: notify.alexa_media
      data_template:
        data:
          type: tts
        target: 
          - media_player.yuval_s_fires
        message: '
              {% if now().strftime("%H")|int < 12 %}
                Good morning,
              {% elif now().strftime("%H")|int < 18 %}
                Good afternoon,
              {% else %}
                Good evening,
              {% endif %}
              {% if is_state("input_boolean.yuval_greeting", "on") and is_state("person.yuval", "home") and is_state("input_boolean.rozi_greeting", "on") and is_state("person.rozi", "home") %}
                Yuval Family.
              {% elif is_state("input_boolean.yuval_greeting", "on") and is_state("person.yuval", "home") %}
                Yuval.
              {% elif is_state("input_boolean.rozi_greeting", "on") and is_state("person.rozi", "home") %}
                Rozi
              {% endif %}.' 

the code,

  • If I shorten the message to just one example sentence:
    “Hello there im in home”,is working
  • If I list all the variables not working - please help thanks.