[Solved] Remove Last Few Digits from Sensor

Hi,

How can I removes few digits from this sensor: it’s reporting as 6342013.29 and I would like to get it to report as 6342.01

  - name: "Cobalt Total Distance"
    unique_id: "cobalt_total_distance"
    unit_of_measurement: "km"
    state: "{{ state_attr('device_tracker.chevrolet_cobalt', 'totalDistance') }}"

Thanks in advance

  - name: "Cobalt Total Distance"
    unique_id: "cobalt_total_distance"
    unit_of_measurement: "km"
    state: "{{ ((state_attr('device_tracker.chevrolet_cobalt', 'totalDistance')|float(0))/1000)|round(2) }}"

You might not need the |float conversion if it’s already a number (which states are not but attributes can be) but it doesn’t hurt to include it.

Thanks Alot!