Template "has_value" trigger returns false cannot be used in Automation

I’m using a has_value template, below which works to provide a true / false value, to identify if a device is offline.

I then want to use this in an automation to provide TTS / Notifications when the device goes offline, but when using templates in an automation it only triggers on a false to true result, but I need a true to false trigger.

Any ideas ?

{{ has_value('xxxxxxxxx.xxxxxxxxxx') }}

Please post the full automation

{{ not has_value('xxxxxxxxx.xxxxxxxxxx') }}

You also do not need to use a template trigger. A state trigger will do.

trigger:
  - platform: state
    entity_id: xxxxxxxxx.xxxxxxxxxx
    to:
      - unknown
      - unavailable

Thanks all :+1: