Need help with water cost not giving correct total will pay for correct sensor


ive tried making cost sensor and doing manual in energy dashboard cant get correct total 1p per litre can anyone help

  - platform: template
    sensors:
      water_usage_cost:
        unique_id: a66aa76c-16f7-4650-8ce9-51563de1c30f
        value_template: "{{ (states('sensor.water_valve_water_consumed')|float * 0.01) | round(2) }}"
        unit_of_measurement: 'GBP/L'  # Or your currency
        device_class: monetary
        friendly_name: "Water Usage Cost"

this give me price but does not update is this correct?

Can some one make a sensor that will work for me ill PAY SOMEONE TO MAKE if sensor works has it should hi have a value that gives correct water usage in litres but needs conversion to GBP/L and resets every month.

http://homeassistant.local:8123/config/energy

OR

http://homeassistant.local:8123/config/helpers

WBR, Oleg

hi ive done all that already

1 Like

1 Like

value_template: "{{ (states('sensor.water_valve_water_consumed')|float * 0.01) | round(2) }}"

You are reading the water used in liters. You need that to calculate the total price but the goal of this sensor is only to set a price per liter as indicated by the unit of measurement of GBP/L. If you simply want to set the price to 1 pence a liter the value template should be β€œ0.01” nothing more.

But if you just want to set a static price you don’t need a price sensor, you just set it in the UI, use a static price rather than your water usage cost entity. One radio button down. https://community-assets.home-assistant.io/original/4X/4/b/b/4bb2b27cf7c6f2a25425f4705b99ac5e9e06b750.jpeg

Once the price is set in Β£/L then home assistant will use the water consumed in liters and multiply it with the price per liter.to get a total price for that period.