Help with converting value derived from Victron SmartShunt

When I use a Entity Card for the Time Remaining sensor it shows a value of 1092:15:00, however when I use a Guage Card it shows 65,535. What I would like is to show a guage with the number of days remaining.

I’ve tried creating a template as follows but it seems to be viewing the “:” in the output and failing.

- platform: template
  sensors:
    minutes_to_hours:
      value_template: >
        {% set ct = states('sensor.smartshunt_hq2227uxhfm_time_remaining') | int %}
        {% if ct == 0 %}
          Unavailable
        {% elif ct > 60 %}
          {{ ct // 60 }}:{{ '{:0>2d}'.format(ct%60) }} hours
        {% else %}
          {{ ct }} minutes
        {% endif %}

Any ideas on how to fix this?

This works in Developer Tools | Template:

  {{ ct // 60 }}{{ ':{:0>2d}'.format(ct%60) }} hours

I moved the : inside the single quotes.

Thanks for the quick reply J, I’m still getting this error.

Sensor None has device class ‘duration’, state class ‘measurement’ unit ‘min’ and suggested precision ‘None’ thus indicating it has a numeric value; however, it has the non-numeric value: ‘- platform: template sensors: minutes_to_hours: value_template: > 1092::15 hours’ (<class ‘str’>)

And in the logviewer this…

ValueError: Sensor sensor.time_remaining_in_hours has device class ‘duration’, state class ‘measurement’ unit ‘min’ and suggested precision ‘None’ thus indicating it has a numeric value; however, it has the non-numeric value: '- platform: template
sensors:
minutes_to_hours:
value_template: >

      1092::15 hours' ()

Yeah. I didn’t try it in a sensor. Just the dev tools.

I’ll try and play with it tomorrow.

Thank you!