Template for garage door position

Hi:

Trying to create a template for garage door position. I have two sensors and am able to combine them into oped, closed, and moving. I would like to have opening, closing, open, and closed. Not quite sure how to go about this and was hoping someone could point me in the right direction:

garage_door_position_new:
  friendly_name: Garage door position
  value_template: >-
    {% if states('binary_sensor.overhead_garage_door') == 'on' 
    and states('cover.athom_garage_door') == 'open' %}
    moving
    {% elif states('cover.athom_garage_door') == 'closed' %}
    closed
    {% elif states('binary_sensor.overhead_garage_door') == 'off' %}
    open
    {% endif %}

if that sensor is sensor.garage_door_position_new and working properly to show open, closed, and moving, then you can use it to create a new one that includes direction using this template. use this for a template sensor… let’s call this new sensor sensor.garage_door_direction:

{% if states('sensor.garage_door_position_new') == "moving" %}
    {% if states('sensor.garage_door_direction') == "closed" %}
        opening
    {% elif states('sensor.garage_door_direction') == "open" %}
        closing
    {% else %}
         {{ states('sensor.garage_door_direction') }}
    {% endif %}
{% else %}
   {{ states('sensor.garage_door_position_new') }}
{% endif %}

Thanks! I’ll play around with it once I have some free time