Device "turned_off" (also) always triggers on a reboot. How to avoid?

I have an automation like this:

alias: Climate / IR Panels DiningRm / Off
description: ""
trigger:
  - platform: device
    type: turned_off
    device_id: 21ba47d6953bff8a6e79c485285d9391
    entity_id: e3b730ee7a3d580006cc7fde486eedd7
    domain: switch
  - platform: device
    type: turned_off
    device_id: 84f00fe3b7b122ffa7cec77dc6debf35
    entity_id: 5eff716f4d558fd6ae34608643a6a66c
    domain: switch
condition: []
action:
  - service: media_player.play_media
    target:
      entity_id: media_player.muse_luxe_diningrm
    data:
      media_content_id: >-
        media-source://tts/google_translate?message=Heating+Panels+off.&language=en-us
      media_content_type: provider
    metadata:
      title: Heating Panels off.
      thumbnail: https://brands.home-assistant.io/_/google_translate/logo.png
      media_class: app
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: app
          media_content_id: media-source://tts
        - media_content_type: provider
          media_content_id: >-
            media-source://tts/google_translate?message=Heating+Panels+off.&language=en-us
    enabled: true
mode: single

It’s supposed to play a message on a speaker (and other things which I have omitted here for simplicity) when the switch is turned OFF.

This works BUT the automation also triggers every time Home Assistant reboots.

How can I avoid this?

How/where is that switch you’re triggering on defined? A particular integration? Is this a template switch?

Show the history of the switch around the time of a restart. It might be changing state from unavailable, in which case you can use a state trigger with a not_from option. See my next note.

Also, rather use state triggers.

It’ll be going from “unavailable” or “unknown” to “off”. If it stays properly connected in normal use you could do this, using state triggers which are objectively better than device triggers:

trigger:
  - platform: state
    entity_id:
      - switch.ENTITY_ID_1
      - switch.ENTITY_ID_2
    from: "on"
    to: "off"

Alternatively / as well, you could install the uptime integration, and include a (template shorthand) condition:

condition:
  - "{{ (now() - states('sensor.uptime')|as_datetime).total_seconds() > 120 }}"

That will prevent the action being run within two minutes (120s) of an HA restart.