Time output in minutes, want it to hours:minutes

I set up a card to monitor what my NzbGet is doing, all is working fine, but the uptime shows in minutes.
Here is the code I set in configuration.yaml

- platform: nzbget
    host: 192.168.1.242
    username: !secret nzuser
    password: !secret nzpass
    monitored_variables:
      - uptime
      - article_cache
      - download_rate
      - download_size

and the output that produces is this:
nzbmin
I would love to have this output in hours:minutes if its doable? I just dont have the skills yet to code this. Anyone able to help me out ?

Kind regards
DigiNorse

create a template sensor and set this as the value_template:

value_template: >
  {% set time = states.whatever_your.sensor_is.state %}
  {% set hours = ((time | int /  60) | string).split('.')[0] %}
  {% set minutes = time | int % 60 %}
  {{hours}} hours and {{minutes}} minutes

It gets more complicated if you really need to remove the ā€œsā€ from the end of hours and minutes.

Thank you for the reply.
I know just about enough code to see how this will change my output, but sadly not how to implement this into my existing code.
Kind regards
DigiNorse

sensor:
  - platform: template
    sensors:
      nzbget_uptime_formatted:
        friendly_name: "Nzbget uptime formatted"
        entity_id: sensor.whatever_your_sensor_is
        value_template: >
          {% set time = states.sensor.whatever_your_sensor_is.state %}
          {% set hours = ((time | int /  60) | string).split('.')[0] %}
          {% set minutes = time | int % 60 %}
          {{hours}} hours and {{minutes}} minutes
1 Like

Thank you ! Very kind of you.

Kind regards
DigiNorse

1 Like