littlemaui
(Shawn Haywood)
March 16, 2024, 1:21am
1
Is it possible to place the dollar sign in front of a value displayed in a gauge card?
I use the following template sensor to calculate the dollar value of energy used today (see example).
- name: "Hot Tub Cost Today"
unique_id: "hot_tub_cost_today"
state: "{{(states('sensor.hot_tub_9_1d') | float * 0.16) | round(2) }}"
maybe this?
- name: "Hot Tub Cost Today"
unique_id: "hot_tub_cost_today"
state: "$ {{(states('sensor.hot_tub_9_1d') | float * 0.16) | round(2) [:1]}}"
littlemaui
(Shawn Haywood)
March 16, 2024, 6:35pm
3
Thank you for the suggestion. Unfortunately, the value won’t display in the gauge when I do that.
state: "${{(states('sensor.hot_tub_9_1d') | float * 0.16) | round(2) | replace('$', '')}}"
littlemaui
(Shawn Haywood)
March 16, 2024, 10:47pm
5
No go. Same message as above.
SCClockDr
(George R Dunham)
March 16, 2024, 11:10pm
6
I believe this might do the deed.
- name: "Hot Tub Cost Today"
unique_id: "hot_tub_cost_today"
state: "{{'$'}}{{(states('sensor.hot_tub_9_1d') | float * 0.16) | round(2) }}"
littlemaui
(Shawn Haywood)
March 17, 2024, 2:25am
7
Unfortunately, same message! Bummer.
i believe there’s no amount of mucking with the state that is going to succeed. the card relies upon the state being a number in order for it to place the needle in the gauge.
i think the primary avenue of hope would be if something like card_mod gave you a way to overlay text or an icon onto it, but i’m not an expert in card_mod.
1 Like