Entities card - show very small numbers

I started working with Trends. The gradient attribute is a very small number (gradient: 0.0000742327418418622). In the frontend it shows as zero (0). Is it possible to show the number in scientific notation or so?

Assuming that the gradient value is an attribute of sensor.trend you can create a template sensor like this:

template:
  - sensor:
      - name: Scientific number
        state: "{{ '%+.4E' | format( state_attr('sensor.trend', 'gradient') | float(0) ) }}"

When preferred, E can be interchanged with e, and 4 defines the number of decimal places.

1 Like