Device is offline notification error

Please format your posts correctly in future, see: https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

You can’t use templates with device triggers. You need to use a state trigger instead,

trigger:
  - platform: state
    entity_id: <your_entity_id_here>
    to:
      - unknown
      - unavailable
action: 
 ...

You should avoid device ids in your automations: