My council just charges an annual fee based upon the size (diameter) of the connection. For me this is 20mm connection for $177 per annum, that they then just charge 25% of per quarterly bill. Assuming your probably the same with your council.
Would it be simplest to work on using an extrapolated daily rate for the water_supply_charge ?
i.e. $177 / 4 = $44.25. Then $44.25 / 90 = $0.4916666666666667 per day (i.e. 360 days p.a. , this works out more accurate than $177 / 365).
Even though HA Energy doesn’t allow for a “sewerage meter” LoL, if we want to show the water bill more accurately aligning to the quarterly bill, we can factor in the daily sewerage cost ?
Instead of adding a sensor for sewerage_supply_charge and then having to update the formulas to add this into the total, this could be simply added by adding this into the water_supply_charge daily rate.
For example my council is $790 p.a. for sewerage, divide this by 365 = $2.164383561643836 per day.
Adding $2.164383561643836 (sewer) and $0.4916666666666667 (water) supply charges gives an extrapolated daily fees of $2.656050228310503 that will provide a supply charge within a few $ each quarter. ?
Looking at the gas and referencing a bill:
It looks like whilst the gas meter gets a pulse for every 10L (or 0.01m3) they then multiply this by a “correction factor” to account for the changes in volume causes by temperature, before it is then multipled by the “heating value” (that seems to vary according to the supplier you have… 38.3 seems to be the scientific rate though) to convert it to MJ.
To add in the correction factor, thinking would an addition sensor be required, instead of adding the correction to gas_consumption_m3? Having gas_consumption_m3 and then another sensor for gas_consumption_corrected_m3 would then mean you have a sensor tracking the actual gas meter reading to match up to the paper bill, whilst then having another sensor that has the corrected m3 that can then be used in calculating the HA daily/weekly gas bill?
This would mean your code could be updated with:
- name: Gas Consumption M3
unique_id: gas_consumption_m3
state: "{{ states('counter.gas_counter') | float(0) * 0.01 }}"
unit_of_measurement: "m³"
icon: mdi:fire
device_class: gas
state_class: total_increasing
- name: Gas Consumption M3 (Corrected)
unique_id: gas_consumption_m3_corrected
state: "{{ states('sensor.gas_consumption_m3') | float(0) * 0.9775 }}" # Change 0.9775 to your retailers CORRECTION FACTOR
unit_of_measurement: "m³"
icon: mdi:fire
device_class: gas
state_class: total_increasing
- name: Gas Consumption MJ
unique_id: gas_consumption_mj
state: "{{ states('sensor.gas_consumption_m3_corrected') | float(0) * 38.3 }}"
unit_of_measurement: "MJ"
icon: mdi:fire
device_class: gas
state_class: total_increasing
I assume this would also then mean adding to the utility_meter(s) to have:
utility_meter:
gas_consumption_daily:
source: sensor.gas_consumption_m3
name: Gas Consumption Daily
cycle: daily
gas_consumption_daily_corrected:
source: sensor.gas_consumption_m3_corrected
name: Gas Consumption Daily (Corrected)
cycle: daily
gas_consumption_monthly:
source: sensor.gas_consumption_m3
name: Gas Consumption Monthly
cycle: monthly
gas_consumption_monthly_corrected:
source: sensor.gas_consumption_m3_corrected
name: Gas Consumption Monthly (Corrected)
cycle: monthly
gas_consumption_yearly:
source: sensor.gas_consumption_m3
name: Gas Consumption Yearly
cycle: yearly
gas_consumption_yearly_corrected:
source: sensor.gas_consumption_m3_corrected
name: Gas Consumption Yearly (Corrected)
cycle: yearly
Not sure if this is correct, trying to follow the code, it appears that you convert the m3 into MJ (since thats what retailers bill upon) in gas_consumption_mj then you define the baseline (i.e. 0-1905mj rate) in gas_import_rate_mj next I’d assume is to multiple the mj consumed by the cost per mj. This appears to be the intent in what you’ve called gas_import_rate_m3 ?
state: "{{ states('sensor.gas_import_rate_mj') | float(0) * 37 }}"
But looking at the state/formula it appears to be saying to take the gas_consumption_mj by the retailers heating value, and not by the number of mj you’ve consume? If this is supposed to be per mj $ x mj consumed, shouldn’t it be:
state: "{{ states('sensor.gas_import_rate_mj') | float(0) * gas_consumption_mj }}"
All this might be OK for the rolling daily amount, but as you mention there’s the mj usage tiers they charge at, and this appears to not be based upon the usage per day, but instead the usage for the 90-92 billing period. With the total mj used over that period, then being broken down into tier 1 (0-1905mj with Origin), tier 2 (1905-252,558mj with Origin) and then “Remaining” (i.e. 252,558mj+).
NFI for the code to do this, but I would assume this means whilst the daily mj/$ bill showing might be OK for tracking purposes. To get near accurate for the monthly, it means adding up x months prior mj consumed and then trying to break it down into 0-1905 and 1905-252558 etc tiers and their associated cost, then total them up.
Still that isn’t going to be very accurate, as your then just taking the last x months mj, as the basis for these calculations, with these then covering multiple billing periods. Does HA include any way to define billing periods within this code, so you could work out the days you get billed for each quarter (i.e. for example for my 3rd quarter bill above… define 10Aug to 9Nov that should roughly be the same every year) so you could then setup sensors for all four quarters with state/formulas that include the from/to dates to count?
Re the three different charge rates you have, what are the they? Looking at Origin and they have 0-1905mj (everyone will exceed that), then 1905-252,558mj that equates to consuming ~6,595m3 (or around $5,227 in a quarter) so I doubt any “Home users” would hit that 3rd billing tier…?