Template help - integer and commas

Hey all, I’ve got a sensor value such as:

10283.0

and i want it to appear as

10,283

(i.e. no decimals and “thousands” commas added). Can anyone suggest a value template that will do this - at least just dropping the “.0” but commas would be lovely too!

Thanks in advance.

{{"{:,}".format(states('sensor.test')|int)}}

Here you go :slight_smile:

{{ "${:,.0f}".format(10283.0) }}

many thanks both!
here’s the yaml that worked for me:

- platform: template
  sensors:
    template_x5_xdrive30d_mileage:
      friendly_name: "Odometer"
      unit_of_measurement: "kms"
      value_template: >
        {{"{:,}".format(states('sensor.x5_xdrive30d_mileage')|int)}}

Hello.
I need something similar. I have tried to figure out how to make work for me your solution without success.
I need change values like 4852 to 48,52. Someone can help me?

Thank you in advance.

How would I apply this to a card? Specifically the entities card. I tried this, but get an error every time:

type: entities
entities:
  - entity: sensor.us_coronavirus_confirmed
    value_template: >
      {{"{:,}".format(states('sensor.us_coronavirus_confirmed')|int)}}
  - entity: sensor.us_coronavirus_current
  - entity: sensor.us_coronavirus_deaths
  - entity: sensor.us_coronavirus_recovered
title: Corona Virus Stats
state_color: true
show_header_toggle: false