Workarounds for utility value

I have asked questions previously regarding using the Utility Meter integration with manually created utility sensors. so far, no luck with answers to that, so I have been attempting to setup sensors that I may be able to manually manipulate.

I can get my utility readings at 23.59 each day (might miss a few kWh values due to speed of reporting at my energy supplier) which should get me readings for Gas and Electric used each day.

I have set up a sensor as follows:

    utilities_sensor:
      friendly_name: "Gas and Electric Cost"
      unit_of_measurement: "£"
      value_template: "{{ (( states('input_number.todays_gas_cost') | float / 100 ) + ( states('input_number.todays_elec_cost') | float / 100 )) | round(2) }}" 
      attribute_templates: 
        readings_date:  "{{ ( states('input_datetime.utility_reading_date')) }}"
        gas_consumption: "{{ ( states('input_number.todays_gas_consumption') | float ) | round(6) }}"
        electric_consumption: "{{ ( states('input_number.todays_elec_consumption') | float ) | round(6) }}"
        gas_cost_pounds: "{{ ( states('input_number.todays_gas_cost') | float / 100 ) | round(2) }}"
        elec_cost_pounds: "{{ ( states('input_number.todays_elec_cost') | float / 100 ) | round(2) }}"
        gas_tariff_pence: "{{ ( states('input_number.gas_tariff_in_pence') | float ) | round(6) }}"
        elec_tariff_pence: "{{ ( states('input_number.electricity_tariff_in_pence') | float ) | round(6) }}"
        gas_standing_charge_pence: "{{ ( states('input_number.gas_standing_charge_in_pence') | float ) | round(6) }}"
        elec_standing_charge_pence: "{{ ( states('input_number.electricity_standing_charge_in_pence') | float ) | round(6) }}"

It is being populated with values at that time. Ideally it should capture the whole day and thus get the info after midnight but Grafana shows when a sensor was updated so I think I need it updated on the actual day.

I do have a date field but would not know how to utilise that in Grafana.

My main question however is can I give each attribute a unit measurement so that data manipulation and sensor recognition is easier?

:thinking:

....
    elec_standing_charge_pence:
      value_template: "{{ ( states('input_number.electricity_standing_charge_in_pence') | float ) | round(6) }}"
      unit_of_measurement: "p/day"

I did try that but it really does not seem to like the use of value_template for an attribute:

try :thinking:

elec_standing_charge_pence: "{{ ( states('input_number.electricity_standing_charge_in_pence') | float ) | round(6) }}"
  unit_of_measurement: "p/day"

No that isn’t allowed. The Unit of measurement is not accepted.

It is if it is indented at the same column as the attribute but then that unit applies to every attribute in the list - only one unit of measurement allowed under the attribute_templates entry.