Template sensor shows as 'Unavailable'

Hi folks,

I am trying to set up a sensor to track my Utility costs, and it’s showing up as ‘Unavailable’ within the Lovelace interface.

I have the following in configuration.yaml

utility_meter:
  daily_energy_powermeter3:
    source: sensor.powermeter3_energy_power
    cycle: daily
  weekly_energy_powermeter3:
    source: sensor.powermeter3_energy_power
    cycle: weekly
  monthly_energy_powermeter3:
    source: sensor.powermeter3_energy_power
    cycle: monthly    

and

sensor:
  - platform: template
    sensors: 
      powermeter3_cost_month:
        friendly_name: "Server cost this month"
        unit_of_measurement: '$'
        icon_template: mdi:currency-usd
        value_template: "{{ (sensor.monthly_energy_powermeter3 * 2.9)| float }}"

If I check ‘states’ within the developer tools, I see a value for sensor.monthly_energy_powermeter3

any pointers?

Could you please format your pasted code correctly?

See point 11 here: How to help us help you - or How to ask a good question

ok, I update the post.

Template does not render properly.

You can try:

value_template: >-
  {{ states('sensor.monthly_energy_powermeter3') | float * 2.9 }}

thanks, the single quote fixed it for me!