Detect MQTT hang up

I have an arduino that sends MQTT Messages.
Sometimes it hangs up and the received messages have the same value.

Is it possible to detect, when a received MQTT message has the same value for a defined period of time?

Thanks and regards
BJ70

I tried this, but it doesn’t Work

alias: "CERASMARTER hung up "
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.heizkreis_vorlauftemperatur
    for:
      hours: 0
      minutes: 15
      seconds: 0
    to: "{{states('sensor.heizkreis_vorlauftemperatur')}}"
condition:
  - condition: state
    for:
      hours: 0
      minutes: 15
      seconds: 0
    state: states('sensor.heizung_aussen')}}
    entity_id: sensor.heizung_aussen
action:
  - service: notify.mobile_app_pixel_6_pro
    data:
      message: "CERASMARTER hat sich aufgehängt "
mode: single