Counter issues

I’m trying to set up a pocket money counter but not sure if my particular requirements are possible.

I’ve set up a counter via the helper which works fine but it won’t allow me to have decimal increments - is this normal?

Also, am I able to remove the ability to increment/decrement on the child’s device? So she can only view, not edit.


Yes. Counters only support integers (whole numbers, no decimals).

You could use an input_number instead.

    name: "Pocket Money"
    min: 0
    max: 1000
    step: 0.01 # chage this if you want to step in dollars or quarters or whatever
    unit_of_measurement: '$'
    icon: mdi:piggy-bank-outline

Create two scripts, one for incrementing the input_number, one for decrementing. Call them from button tap actions in Lovelace.

To make the input number read only you will have to copy it’s state to a template sensor and display that in Lovelace.

  - sensor:
      - name: "Pocket Money"
        icon: mdi:piggy-bank-outline
        unit_of_measurement: '$'
        state: "{{ states('input_number.pocket_money') }}"
1 Like

Thanks for this, worked perfectly.