Int showing as a string in the web UI

I’ve got this simple sensor, getting data from a command-line script :

- platform: command_line
  name: Printer Pages Count
  command: /config/shell_scripts/printer_pages.sh
  value_template: '{{ value | int }}'
  unit_of_measurement: pages

but it’s showing the number as a string, what could be wrong ?
1 2 3

What does this return (exactly, including any unit) in the template editor:

{{ states('sensor.printer_pages_count') }}

just 169

Hmm. Very odd.

Have you tried refreshing your web browser cache (Ctrl+F5)?

Did you create it with the unit_of_measurement first or without it? If you created it without it first, then added it later. Give it some time and it will correct itself.

yes I tried without success

That’s correct, but it’s been over 2 days already.
For reference I’m using purge_keep_days: 3, so maybe I have to wait 3 days…

It’s now showing as a number. Thanks!

1 Like