Rounding input numbers in entities card?

I want to create a simple entity list card that shows various rainfall totals. I can not change the step size of the input number because its based on a specific number that is has to step. I have a rainfall gauge that trips a door sensor to open/close. Each time it does that, the input number has to be incremented a certain amount, like .0013482 or something.

So I cant just change the step size to 0.1 for the input number. I know I can use a template card and use the float round function. But i dont like the template card formats with the number being under the day, as shown below circled in blue. I like how the entities card has the number to the side, but I dont like the super long numbers.

Is there a formatting solution for the entities card? Or is there some other addon, HACs, etc that I could use that would produce a similar looking result.

image

type: entities
entities:
  - entity: input_number.rainfall_yearly
    icon: mdi:weather-cloudy
    name: Year
  - entity: input_number.rainfall_monthly
    name: Month
    icon: mdi:weather-cloudy
  - entity: input_number.rainfall_this_week
    name: Week
    icon: mdi:weather-cloudy
  - entity: input_number.rainfall_last_week
    name: Last week
    icon: mdi:weather-cloudy

Markdown cards can do a lot, if it does not need to be able to input values.

type: markdown
title: rainfall
content: |
  <table width=100%>
  <tr><td align_left><ha-icon icon="mdi:weather-cloudy"></ha-icon> Year</td><td align=right>{{ states('input_number.rainfall_yearly')|float(0)|round(2, 'common') }}</td></tr>
  <tr><td align_left><ha-icon icon="mdi:weather-cloudy"></ha-icon> Month</td><td align=right>{{ states('input_number.rainfall_monthly')|float(0)|round(2, 'common') }}</td></tr>
  <tr><td align_left><ha-icon icon="mdi:weather-cloudy"></ha-icon> Week</td><td align=right>{{ states('input_number.rainfall_this_week')|float(0)|round(2, 'common') }}</td></tr>
  <tr><td align_left><ha-icon icon="mdi:weather-cloudy"></ha-icon> Last week</td><td align=right>{{ states('input_number.rainfall_last_week')|float(0)|round(2, 'common') }}</td></tr>
  </table>

If you want a specific number of decimals, then it might be better to set the display precision on the entity’s setup page and then use this table isntead.

type: markdown
title: rainfall
content: |
  <table width=100%>
  <tr><td align_left><ha-icon icon="mdi:weather-cloudy"></ha-icon> Year</td><td align=right>{{ states('input_number.rainfall_yearly', rounded=True) }}</td></tr>
  <tr><td align_left><ha-icon icon="mdi:weather-cloudy"></ha-icon> Month</td><td align=right>{{ states('input_number.rainfall_monthly', rounded=True) }}</td></tr>
  <tr><td align_left><ha-icon icon="mdi:weather-cloudy"></ha-icon> Week</td><td align=right>{{ states('input_number.rainfall_this_week', rounded=True) }}</td></tr>
  <tr><td align_left><ha-icon icon="mdi:weather-cloudy"></ha-icon> Last week</td><td align=right>{{ states('input_number.rainfall_last_week', rounded=True) }}</td></tr>
  </table>
1 Like

Thank you @WallyR . I never used a markdown card before. It worked great.