Rounding number in a card?

image

Is there a way to round this number to “15” without having to create a new entity?

As per code below, the state-label is coming from an input_number.cat_door which increases each time the cat goes through his catdoor. (So I know how many times the cat has used it in a day).
All works fine but why does a bloody .0 shows up when the input number is all in whole numbers?

Is there a display way to do this in the card or do I need to create yet, another entity to pass a value template? (my system is becoming such a monster… I so much wish I could do it without this new entity)
?

  - type: image
    image: /local/cat.png
    tap_action:
      action: more-info
    style:
      top: 67.5%
      left: 93.4%
      width: 13%
  - type: state-label
    entity: input_number.cat_door
    style:
      top: 67.5%
      left: 91.4%
      font-size: 130%
      text-shadow: 3px 3px 2px black

Since it’s an input_number you can configure that.
Look in the helper menu.

1 Like

Sadly it doesn’t work. It was at step size “1” when the screenshot was made. It did show it as “0.1” in the card.

Try and delete the entity and create it again.
If it persists then it’s a bug.

HI, I made a mistake in my response… The input_number has a step size of 1. But the number shown when called by a card shows up as “12.0” instead of 12 . There’s now way to round it up in the card itself (so far as I know - this was my original question - so I ended up created an additional value template sensor with a "round (0) to achieve it.

  - platform: template
    sensors:
      catdoorround:
        value_template: >
          {{states('input_number.cat_door')|float|round(0)}}

I just felt it was such an overkill just to correct the input_number.