Cover Template with closing/opening states

I saw that the Cover Template component can now, as of a few weeks ago, support closing/opening states. I was just wondering if anyone had created a Cover Template that looked similar to what I’m looking to create for my gate that they could share?

  • I have an ESP32 controlled relays with Tasmota which can explicitly close and open the gate
  • I have a zigbee bridge and contact sensor attached to the gate which can give me closed and opening states.
  • For open state, I expect I can use a timer for this (e.g. if opening state triggered, switch state of the cover to “open” after 30s, or however long it normally takes the gate to travel to fully open.
  • For closed states, the magnetic sensor can give me this
  • For closing state, I think I can do this by updating the status of the cover (or another entity) to closing once the gate closing action is fired; it will be marked as closed then once the magnetic contract sensor detects the gate has closed.