Formatting value from OpenUV sensor as HH:MM

Hey I’m relatively new to Home Assistant - I’ve been experimenting and built a weather station of sorts.

But I need help formatting one of the sensor values - A UV safe exposure time sensor - the value is in minutes, generally 1000s… I’m in England and it’s winter. At night it reads “Unknown” as I guess there’s no data.

I’d like the value to be displayed as HH:MM

I think it should look something like this - but I’m kind of stumped:

sensor:    
- platform: template
  sensors:
    skin_type_2_safe_exposure_time:
      friendly_name: "UV Safe Exposure Time"
      value_template: '{{ state_attr, timestamp_custom("%H:%M", 0) }}'

…and I guess that it would need to check if there’s a numerical and that the value of the sensor is not “unknown”?

Any help much appreciated!