Rotary Encoder - How to return Stationary status?

Hi All,

I have an ANO Directional Navigation and Scroll Wheel rotary encoder that I’m using with an ESP32 Dev board to try and control my daughters RGBW lights, but I would like it to be pretty flexible and interchangeable with other devices in the future, so instead of calling specific automations I want it to return its current state in home assistant.
So far I have two text sensor entities, one that returns button clicks: Left, Right, Up, Down, Center, Double Click and Held.
And another that returns the direction of rotation: Anticlockwise or Clockwise.

While this works great so far, I cannot figure out how to return “Off” or “Stationary” from the second entity when the wheel has finished turning for say 0.5s.

My code is as follows:

sensor:
  - platform: rotary_encoder
    name: "Rotary Encoder"
    id: rotary_wheel
    pin_a:
      number: GPIO13
      mode:
        input: True
        pullup: True
    pin_b:
      number: GPIO12
      mode:
        input: True
        pullup: True
    max_value: 100
    min_value: 0
    resolution: 4
    on_clockwise:
    - text_sensor.template.publish:
        id: encoder_direction
        state: "Clockwise"
    on_anticlockwise:
    - text_sensor.template.publish:
        id: encoder_direction
        state: "Anticlockwise"

text_sensor:
  - platform: template
    name: "Button Pressed"
    id: button_pressed
  - platform: template
    name: "Encoder Direction"
    id: encoder_direction

I have not included the button YAML as I am comfortable with their operation. Any help would be greatly appreciated, I am quite new to ESPHome and YAML code and though I have tried to resource solutions myself, I feel as though I am exhausting my options because I just don’t know what to look for.
Any ideas?

I don’t know the answer, but that is one cool encoder, thanks. link for the google wary:

My idea would to use the on_value trigger on the encoder sensor.
But the problem would be that the condition has to be true, but I don’t know if this will work.

The condition is always true here, but it will wait 500ms (0.5s).
Now if the on_value trigger stops when a new on_value trigger is made, then this should work, but if a new trigger is queued, then this will probably not work as expected.

on_value:
  then:
    - if:
        condition:
          for:
            time: 500ms
            condition:
              - lambda: 'return true;'
        then:
          - text_sensor.template.publish:
              id: encoder_direction
              state: "Stationary"