Pushover receive message based on location with one automation and multiple devices

Hi All

Does anyone know if there is a solution for my config idea.

I want to use one automation to send a message to 2 mobile phones when washing machine has finished washing based on if you are home or not

When i’m at work I dont wanna receive useless message.

Below is my idea but it isn’t working I tried different ways maybe you can help me
of got some cool idea’s

    priority: 0
  message: >-
    - '{% if is_state(''device_tracker.person1'', ''home'') %}Person1{% endif %}'
    - '{% if is_state(''device_tracker.person2'', ''home'') %}Person2{% endif %}'
  title: Wasmachine is klaar.
service: notify.pushover

more failed attempts below

     '{% if is_state(''device_tracker.person1'', ''home'') %}  - Person1{% endif %}'
     -'{% if is_state(''device_tracker.person2'', ''home'') %} Person2{% endif %}'

Greetz Maurice