Help with template automations

I have the following automation which is supposed to notify me when my kid gets to school/leaves school. It worked when I had the automations segregated, but I tried to combine them and… no dice. I can see that the automation is triggering , but it gets to the step to choose, and skips to the end performing no actions.

Can anyone help me understand why?

alias: Nathan School
description: >-
  Notifies when Nathan gets to school, leaves school, and leaves the house on
  weekdays.
trigger:
  - platform: zone
    entity_id: device_tracker.npixel
    zone: zone.poston
    event: leave
  - platform: zone
    entity_id: device_tracker.npixel
    zone: zone.poston
    event: enter
  - platform: zone
    entity_id: device_tracker.npixel
    zone: zone.home
    event: enter
condition: []
action:
  - choose:
      - conditions:
          - condition: template
            value_template: >
              {{ trigger.platform == 'zone' and trigger.entity_id ==
              'device_tracker.npixel' and trigger.zone == 'zone.poston' and
              trigger.event == 'enter' }}
        sequence:
          - service: notify.mobile_app_dpixel
            data:
              message: Nathan is at school
          - service: notify.mobile_app_jpixel
            data:
              message: Nathan is at school
      - conditions:
          - condition: template
            value_template: >
              {{ trigger.platform == 'zone' and trigger.entity_id ==
              'device_tracker.npixel' and trigger.zone == 'zone.poston' and
              trigger.event == 'leave' }}
        sequence:
          - service: notify.mobile_app_dpixel
            data:
              message: Nathan left school
          - service: notify.mobile_app_jpixel
            data:
              message: Nathan left school
      - conditions:
          - condition: template
            value_template: >
              {{ trigger.platform == 'zone' and trigger.entity_id ==
              'device_tracker.npixel' and trigger.zone == 'zone.home' and
              trigger.event == 'enter' }}
          - condition: time
            after: "12:00:00"
            before: "17:00:00"
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
        sequence:
          - service: notify.mobile_app_dpixel
            data:
              message: Nathan is home from school
          - service: notify.mobile_app_jpixel
            data:
              message: Nathan is home from school
mode: single

Try this version without a choose.

alias: Nathan School
description: >-
  Notifies when Nathan gets to school, leaves school, and leaves the house on
  weekdays.
trigger:
  - platform: zone
    entity_id: device_tracker.npixel
    zone: zone.poston
    event: leave
    variables:
      msg: 'Nathan left school'
      is_true: 'yes' 
  - platform: zone
    entity_id: device_tracker.npixel
    zone: zone.poston
    event: enter
    variables:
      msg: 'Nathan is at school'
      is_true: 'yes' 
  - platform: zone
    entity_id: device_tracker.npixel
    zone: zone.home
    event: enter
    variables:
      msg: 'Nathan is home from school'
      is_true: >
        {{ iif(12 <= now().hour < 17 and 1 <= now().isoweekday() <= 5, 'yes', 'no') }}
condition:
  - condition: template
    value_template: '{{ is_true == 'yes' }}'
action:
  - service: notify.mobile_app_dpixel
    data:
      message: '{{ msg }}'
  - service: notify.mobile_app_jpixel
    data:
      message: '{{ msg }}'
mode: single

The clause above will always fail… the trigger.zone variable returns the state object of the zone, not just it’s entity ID. You would need to use trigger.zone.attributes.entity_id == 'zone.poston'.

Question for you, what’s the purpose of this needlessly long Template Condition when you can simply use the trigger’s id to determine which one of the three triggers occurred?

      - conditions:
          - condition: template
            value_template: >
              {{ trigger.platform == 'zone' and trigger.entity_id ==
              'device_tracker.npixel' and trigger.zone == 'zone.poston' and
              trigger.event == 'enter' }}

Assuming you call the three triggers poston_leave, poston_enter, and home_enter then you can do this:

alias: Nathan School
description: >-
  Notifies when Nathan gets to school, leaves school, and leaves the house on
  weekdays.
trigger:
  - id: poston_leave
    platform: zone
    entity_id: device_tracker.npixel
    zone: zone.poston
    event: leave
  - id: poston_enter
    platform: zone
    entity_id: device_tracker.npixel
    zone: zone.poston
    event: enter
  - id: home_enter
    platform: zone
    entity_id: device_tracker.npixel
    zone: zone.home
    event: enter
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger 
            id: poston_enter
        sequence:
          - service: notify.mobile_app_dpixel
            data:
              message: Nathan is at school
          - service: notify.mobile_app_jpixel
            data:
              message: Nathan is at school
      - conditions:
          - condition: trigger 
            id: poston_leave
        sequence:
          - service: notify.mobile_app_dpixel
            data:
              message: Nathan left school
          - service: notify.mobile_app_jpixel
            data:
              message: Nathan left school
      - conditions:
          - condition: trigger 
            id: home_enter
          - condition: time
            after: "12:00:00"
            before: "17:00:00"
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
        sequence:
          - service: notify.mobile_app_dpixel
            data:
              message: Nathan is home from school
          - service: notify.mobile_app_jpixel
            data:
              message: Nathan is home from school
mode: single

Thank you guys for the responses, I have created new automations with each of these suggestions, and I’ll post back when I see which is working. I really appreciate this community.

This solution seems to be working well now. Thank you for your help folks!

To answer your question about the (needlessly) long template, it wasn’t working with the other attempts I made, so I kept revising the template. Lol, I fell down the rabbit hole.