Morning Tony,
I had to scratch my head bit here, as I’d forgotten what I did and how I did it!
I set up a number of Helpers to create daily, weekly and monthly metering, these are listed here. They are under Settings > Helpers
There is also some yaml to accompany the cost part of these, which goes under the ‘configuration.yaml’ section - (I use Studio Code Server plugin to see & edit this sort of stuff). The numbers used (0.25920) on this yaml is the cost per kWh in £’s charged by the elec Co. BTW, these sort of YAML entries tend to be known as ‘template sensors’. In these, I’ve got Meter Helpers working with these template sensors. The first one for Daily Cost uses a Meter Helper called Elec Daily Consumption - this total is multiplied by the cost per kWh, and then spewed out using the unique_id of daily_electric_cost - it is pretty much replicated for the other cost examples on here - Meter Helpers to log the time interval kWh totals, and then use cost from Template Sensors - the Template Sensors also end up as Helpers too (it seems)
template:
- sensor:
- name: "Daily Electric Cost" # Use a Meter Helper for display in Dashboard
unique_id: daily_electric_cost
state: "{{ (states('sensor.electricity_daily_consumption')|float * 0.25920)|round(2) }}"
availability: "{{ states('sensor.electricity_daily_consumption')|is_number }}"
unit_of_measurement: "£"
device_class: monetary
state_class: total
- name: "Weekly Electric Cost" # Create a Meter Helper "Weekly Electric Cost" for display in Dashboard
unique_id: weekly_electric_cost
state: "{{ (states('sensor.electricity_weekly_consumption')|float * 0.25920)|round(2) }}"
availability: "{{ states('sensor.electricity_weekly_consumption')|is_number }}"
unit_of_measurement: "£"
device_class: monetary
state_class: total
- name: "Monthly Electric Cost" # Create a Meter Helper "Monthly Electric Cost" for display in Dashboard
unique_id: monthly_electric_cost
state: "{{ (states('sensor.electricity_monthly_consumption')|float * 0.25920)|round(2) }}"
availability: "{{ states('sensor.electricity_monthly_consumption')|is_number }}"
unit_of_measurement: "£"
device_class: monetary
state_class: total
Using a combination of the YAML and Meter Helpers I can pull stuff such as this into my Dashboard
The Meter Helpers are the key as they allow you to take the main kWh log and manipulate it into daily, weekly, and other totals.
This may be useful - Utility meter helper kwh
and have a read of this too - Utility Meter - Home Assistant
Gas Meter
Is your gas meter a ‘dumb’ one at all? If it is, then this may help you with yours, it is the main thread for me automating my own dumb gas meter.
It’s a long read, so either grab a brew or a cold one and settle in for weeks of head-scratching and frustration. I solved it in the end, and it works like an absolute beaut’ now. More accurate than the elec’ meter too!!
I hope the above helps,
Cheers,
Mike