Hi, i freaking love this card. brilliant creation!
Use case: I’m using decluttering card for stock charts, about 60 of them. A few are venture stocks with stock price less than $1. I want 3 decimal places. Most have stock prices between 1 and 999 where I want 2 decimal places, and a few, such as the indexes themselves, bitcoin… are > 1000.
Ideally I would like to put script in the decimals: variable in the declutter card itself, for example this:
decimals: >
{% set symb = '[[symbol]]' %}
{% set val = states(symb)|float(0) %}
{% if val < 1 %}
{% set decimals = 3 %}
{% elif val < 1000 %}
{% set decimals = 2 %}
{% else %}
{% set decimals = 0 %}
{% endif %}
{{ decimals }}
But it fails. I don’t know if my syntax is wrong, or if there is fundamentally no way this will work. Anyone doing something like this, or has suggestions?
thanks