I want to move the £ to the front

image

Could someone please shed some light on this for me. I want to move the £ to the front 0.09 (£ 0.09)
This is my template and I know I could put the £ sign in my template like this
{{ £ ((states('sensor.ftank_daily_energy_usage_peak') | float * 0.1863)
but this affects my mini graph and it just displays NaN.

- platform: template
    sensors:
      ftank_cost_daily:
        friendly_name: "Fish Tank Energy Cost Today"
        icon_template: mdi:currency-gdp
        value_template: "{{ ((states('sensor.ftank_daily_energy_usage_peak') | float * 0.1863) + (states('sensor.ftank_daily_energy_usage_offpeak') | float) * 0.0936 ) | round(2) }}"

What are my options?

Also, this is supposed to display 0.10 but I’m seeing this.

image

Thank you in advance

Your only option is to make a custom card. That already appears to be a custom button card, so you’ll need to adjust the css and move the units in front of the value for that particular card.

You can also bake it into your template - although you won’t be able to graph it from that as it will become a text sensor:

platform: template
sensors:
  house_power_cost:
    friendly_name: House Power Cost
    value_template: >
      £{{ "%.2f" | format(((states('sensor.daily_house_power_monitor_energy') | float * 0.1560) | float + 0.2)) }}
1 Like

I feel like no one read this line from OP

Hence why his only option is to adjust the button itself.

You’re right. I did ignore that :joy:

thanks for all your help with this so far. So ignoring the mini graph issue how would I get my template to look like this £0.20

- platform: template
    sensors:
      ftank_cost_daily:
        friendly_name: "Fish Tank Energy Cost Today"
        icon_template: mdi:currency-gdp
        value_template: "{{ ((states('sensor.ftank_daily_energy_usage_peak') | float * 0.1863) + (states('sensor.ftank_daily_energy_usage_offpeak') | float) * 0.0936 ) | round(2) }}"
- platform: template
    sensors:
      ftank_cost_daily:
        friendly_name: "Fish Tank Energy Cost Today"
        icon_template: mdi:currency-gdp
        value_template: "£{{ ((states('sensor.ftank_daily_energy_usage_peak') | float * 0.1863) + (states('sensor.ftank_daily_energy_usage_offpeak') | float) * 0.0936 ) | round(2) }}"

ok, will that stop it from displaying £0.1 when it should be £0.10?

not necessarily.

This will, it’ll also add comma’s every thousand.

- platform: template
    sensors:
      ftank_cost_daily:
        friendly_name: "Fish Tank Energy Cost Today"
        icon_template: mdi:currency-gdp
        value_template: >
          {{ '£{:,.2f}'.format(((states('sensor.ftank_daily_energy_usage_peak') | float * 0.1863) + (states('sensor.ftank_daily_energy_usage_offpeak') | float) * 0.0936 ) | round(2)) }}


Ok, thank you all for your help today. So what I have done to get both the Mini graph and for it to display £ 0.00 is created 3 templates.
1 for Daily usage displaying £ 0.00
1 for Daily Usage (Mini Graph)
1 for Monthly Usage displaying £ 0.00

this is my code

########## Fish Tank Costs ##########
  - platform: template
    sensors:
      ftank_cost_daily:
        friendly_name: "Today's Total FishTank Cost"
        icon_template: mdi:currency-gbp
        value_template: "{{ '£ {:,.2f}'.format(((states('sensor.ftank_daily_energy_usage_peak') | float * 0.1863) + (states('sensor.ftank_daily_energy_usage_offpeak') | float) * 0.0936 ) | round(2)) }}"
      ########## Fish Tank Cost (Mini Graph)  ##########
  - platform: template
    sensors:
      ftankmg_cost_daily:
        friendly_name: "Today's Total FishTank Cost"
        unit_of_measurement: '£'
        icon_template: mdi:currency-gbp
        value_template: "{{ ((states('sensor.ftank_daily_energy_usage_peak') | float * 0.1863) + (states('sensor.ftank_daily_energy_usage_offpeak') | float) * 0.0936 ) | round(2) }}"        
  - platform: template
    sensors:
      ftank_cost_monthly:
        friendly_name: "Monthly Total FishTank Cost"
        icon_template: mdi:currency-gbp
        value_template: "{{ '£ {:,.2f}'.format(((states('sensor.ftank_monthly_energy_usage_peak') | float * 0.1863) + (states('sensor.ftank_monthly_energy_usage_offpeak') | float) * 0.0936 ) | round(2)) }}"

and this is my output

image

Not sure what other options I have.

Is that the custom button card?

image

If so, post the configuration.

No this is an Entity Card that is being used within a grid card.

Ok, then your only option is what you did.

I’m assuming you was thinking this customized with some CSS?

I haven’t got that far yet, still learning the basics. Do you have any examples that would help me with the CSS?

Yes and no. The custom button card lets you layout anything in any order using yaml to adjust the css. The layout you have is a typical button card layout. You could make a custom:button-card template and then use the template whenever you want currency displayed. Without needing template sensors.

Whoosh straight over my head, I will have to do some more investigation once I get 5 mins. Thanks for all your help tho.

Every Thousand? how much do think my Fishtank costs to run LOL

Lol, it’s partly for others who come to this page for the same thing. It won’t hurt you, but if you get that high, it’ll be formatted properly!

understood I was only joking thanks for all your help.

Regards

This is what I did to calculate my utilities:

  - platform: template
    sensors:
      monthly_water:
        friendly_name: "Monthly Water Usage"
        value_template: "{{ '$ {:,.2f}'.format(states('sensor.flume_sensor_stylus_current_month') | float(0) * 0.008760086197216 | float(0) | round(2)) }}"