Alert for failure of a network device

Hi folks,

I want to be notified, when a special networkdevice will fail.

the entitiy looks like this:

source_type: router
mac: 00:EE:4D:CE:10:7E
host_name: CANBUS-CLIENT
last_time_reachable: '2021-08-31T10:56:35+00:00'
friendly_name: CANBUS-CLIENT
icon: mdi:lan-connect

and I made an automation like this:

- id: '1630407735728'
  alias: Ausfall CANBUS-CLIENT
  description: ''
  - platform: state
    entity_id: device_tracker.canbus_client
    attribute: last_time_reachable
  - condition: not
    - condition: state
      entity_id: device_tracker.canbus_client
      state: CANBUS-CLIENT
      attribute: host_name
  - service: notify.mobile_app_oneplus_a6003
      message: CANBUS-CLIENT ist ausgefallen
  mode: single

Why does it not work?

I still don’t have any idea.
I think that I have to use the ‘last_time_reachable’ attribute, but I don’t know how.

Is there anybody who wants to help me?

Likely because you trigger on the last_time_reachable which, by definition, will not change if the device is not reachable.
Assuming the entity is a device_tracker, just trigger on the state (remove the attribute part) and the condition should be "not home" or just not_home. The values for a device_tracker are fixed.