Hi,
So I am trying to setup tariffs for my water meter. But I have a bit of weird setup I guess. I tried searching but couldn’t really find much for water
CCF for gas is ‘1000’
My meter measures in gallons
I have an RTLAMR/SDR capturing meter readings.
CCF from my water company is specified at 748 Gallons
1-4 CCF is $2.67
4-20 CCF is $4.45
Waste Water is $4.67/CCF
If I used 6 CCF, I would be charged Teir 1 for the first four(2.67x4) and teir 2 for CCF 5&6 (4.67x2), as well as a total for waste water at flat rate (4.67x6)
Does anyone have a clue how to begin to calculate this?
Create new monthly utility meter “Water Meter” using the consumption sensor from AMR/SDR, with ‘tier 1, tier 2, tier 3’** as tariffs.
this gives us 4 entities
select.water_meter
sensor.water_meter_tier_1
sensor.water_meter_tier_2
sensor.water_meter_tier_3
Create new monthly utility from the same consumption sensor for waste water.
sensor.waste_water_meter
Create new template sensors
configuration.yaml
# Include Templates
template: !include_dir_list templates/
templates/utilities/water_ccf_to_gal.yaml
sensor:
- name: Water Tariff Price
unit_of_measurement: USD/gal
state: >
{# 1 CCF = 748 Gallons #}
{# 1-4 CCF Tier 1 Billing Rate $2.67/CCF #}
{% if is_state('select.water_meter', 'tier 1') %}
{{ 2.67 / 748 }}
{# 4-20 CCF Tier 2 Billing Rate $4.45/CCF #}
{% elif is_state('select.water_meter', 'tier 2') %}
{{ 4.45 / 748 }}
{# 21+ CCF Tier 3 Billing Rate $4.67/CCF #}
{% else %}
{{ 4.67 / 748 }}
{% endif %}
- name: Waste Water Tariff Price
unit_of_measurement: USD/gal
state: >
{# 1 CCF = 748 Gallons #}
{# Waster Water Billing Rate $4.67/CCF #}
{{ 4.67 / 748 }}
Add your original sensor.water_meter to the energy dashboard.
Add the waste water sensor sensor.waste_water_meter to the energy dashboard.
Set the tariff price to the corresponding template sensor above for each.
Create automations for Regular water Tariff Switching
Tier 1
alias: Tariff - Water Tier 1 Rate
description: Set Tier 1 Billing Rate when usage 1-4 CCF
trigger:
- platform: state
entity_id:
- sensor.water_meter
condition:
- condition: template
value_template: |-
{# 1 CCF = 748 Gallons #}
{# 1-4 CCF Tier 1 #}
{{ states('sensor.water_meter') | float / 748 < 4 }}
action:
- service: select.select_option
data:
option: tier 1
target:
entity_id: select.water_meter
mode: single
Tier 2
alias: Tariff - Water Tier 2 Rate
description: Set Tier 2 Billing Rate when usage 4-20 CCF
trigger:
- platform: state
entity_id:
- sensor.water_meter
condition:
- condition: template
value_template: |-
{# 1 CCF = 748 Gallons #}
{# 4-20 CCF Tier 2 #}
{{ states('sensor.water_meter') | float / 748 > 4 }}
action:
- service: select.select_option
data:
option: tier 2
target:
entity_id: select.water_meter
mode: single
Tier 3
description: Set Tier 3 Billing Rate when usage 21+ CCF
trigger:
- platform: state
entity_id:
- sensor.water_meter
condition:
- condition: template
value_template: |-
{# 1 CCF = 748 Gallons #}
{# 21+ CCF Tier 2 #}
{{ states('sensor.water_meter') | float / 748 > 21 }}
action:
- service: select.select_option
data:
option: tier 3
target:
entity_id: select.water_meter
mode: single
alias: Tariff - Water Tier 3 Rate
2 Likes
I’m trying to get this to work but cant seem to get the values to calculate correctly. does the cron not work with this template?
sensor:
- name: electricity Tariff Price
unit_of_measurement: CAD/kwh
state: >
{# 1-1350 kwh Tier 1 Billing Rate $0.0975/kwh #}
{% if is_state('select.energy_sensor', 'tier 1') %}
{# 1350+ kwh Tier 2 Billing Rate $0.1405/kwh #}
{% elif is_state('select.water_meter', 'tier 2') %}
{% endif %}
cron: " 23 59 5 2,4,6,8,10,12"
You have two different meters mentioned in your template. check the entity ids… one is electric one is water @Manbearpig92
Manbearpig92:
sensor:
- name: electricity Tariff Price
unit_of_measurement: CAD/kwh
state: >
{# 1-1350 kwh Tier 1 Billing Rate $0.0975/kwh #}
{% if is_state('select.energy_sensor', 'tier 1') %}
{# 1350+ kwh Tier 2 Billing Rate $0.1405/kwh #}
{% elif is_state('select.water_meter', 'tier 2') %}
{% endif %}
cron: " 23 59 5 2,4,6,8,10,12"
You also are not providing a value for what the price should be.
If you look at mine. I have a calculation under the election of the teir before the next elif/else so you aren’t calculating a price per unit
try
sensor:
- name: electricity Tariff Price
unit_of_measurement: CAD/kwh
state: >
{# 1-1350 kwh Tier 1 Billing Rate $0.0975/kwh #}
{% if is_state('select.energy_sensor', 'tier 1') %}
{{ 0.0975 }}
{# 1350+ kwh Tier 2 Billing Rate $0.1405/kwh #}
{% else %}
{{ 0.1405 }}
{% endif %}
cron: " 23 59 5 2,4,6,8,10,12"
1 Like
thanks for your help. I actually ended up solving this. with this code:
# Utility Meter Configuration
utility_meter:
energy_bi_monthly:
source: sensor.energy_usage_kwh
cycle: bi-monthly
billing_day: 5
billing_hour: 23
cron: "0 0 6 2,4,6,8,10,12 *"
# Sensor Configuration
sensor:
- platform: integration
source: sensor.power_usage_watts
name: "energy_usage_kwh"
unit_prefix: k
round: 2
method: left
- platform: template
sensors:
current_bill:
friendly_name: "Current Bill"
unit_of_measurement: "CAD"
value_template: >
{% set energy_usage = states('sensor.energy_usage_kwh') | float %}
{% if energy_usage <= 1350 %}
{{ (energy_usage * 0.0975) | round(2) }}
{% else %}
{{ (1350 * 0.0975 + (energy_usage - 1350) * 0.1405) | round(2) }}
{% endif %}
Gotcha, no problem. But just for sanity sake, for everyone else that reads this, your method is not actually calculating the tarrif for the energy dashboard, just a stand alone entity for any dashboard.
1 Like
yes thats correct, wasnt sure how it would work for me since i’m on a bi-monhtly schedule so i figured i’d just make my own