Trigger - see status 5 seconds ago, if same do nothing, if not change

So, I have a led strip that shows its color over the state attributes.
So i wanna sync a couple of them.

So far i’m able to get the color status, but I can’t find a code to check the status 5 seconds ago to se if it changed or not.

if it changes, it will send a assistant relay to google to change it to the same color.

    value_template: "{{states.light.led_iana.attributes.color}}"
- id: light_sync
  - platform: state
    entity_id: light.led_iana
    to: (here I want it to check the last 5 seconds)
  - service: rest_command.assistant_relay
      message: change Pedro led light to "{{states.light.led_iana.attributes.color}}"


Is this what you want? It triggers when the value of the color attribute remains unchanged for at least 5 seconds. So if the color turns red and stays that way for 5 seconds, it triggers.

  - platform: state
    entity_id: light.led_iana
    attribute: color
    for: '00:00:05'