My utility provider has a couple conditionals at which we are billed on per month, but I am at a complete loss on the YAML side given those extra complexities.
If anyone could help walk me through how to create sensor(s?) for the varying tariff conditions outlined below, I’ll do my best keep up.
Assumptions:
Ignore Basic Service fee/charge
Four conditions for energy rate
Summer (June through Sept) or Winter (October through May)?
Hi, you can do this fairly easy with one or more template sensors.
I assume you are using the energy dashboard and you have allready a sensor tracking your energy consumption?
Something like this should do it, depending on which consumption sensor you allready have.
Fortunately, it looks like the utility meter docs cover that pretty comprehensively (I’ll just have to simplify the state to reference my one entity named sensor.electric_meter).
template:
- sensor:
- name: 'Daily Energy Total'
device_class: energy
unit_of_measurement: kWh
state: >
{% if is_number(states('sensor.daily_energy_offpeak')) and is_number(states('sensor.daily_energy_peak')) %}
{{ states('sensor.daily_energy_offpeak') | float + states('sensor.daily_energy_peak') | float }}
{% else %}
None
{% endif %}
- name: 'Monthly Energy Total'
device_class: energy
unit_of_measurement: kWh
state: >
{% if is_number(states('sensor.monthly_energy_offpeak')) and is_number(states('sensor.monthly_energy_peak')) %}
{{ states('sensor.monthly_energy_offpeak') | float + states('sensor.monthly_energy_peak') | float }}
{% else %}
None
{% endif %}
It’s tracking cost in the Energy dashboard from the sensor you helped with in templates.yaml, but I think in the utility_meter section, I need to retain the “tariffs” section mentioned in the docs. In the docs, it’s not really clear to me how to have that respect the sensor.electricity_price.
Here is the YAML from the docs, for reference of what I’m talking about:
Assuming your energy provider tariffs are time based according to:
peak: from 9h00 to 21h00
offpeak: from 21h00 to 9h00 next day
a time based automation can be used:
automation:
trigger:
- platform: time
at: "09:00:00"
variables:
tariff: "peak"
- platform: time
at: "21:00:00"
variables:
tariff: "offpeak"
action:
- service: select.select_option
target:
entity_id: select.daily_energy
data:
option: "{{ tariff }}"
- service: select.select_option
target:
entity_id: select.monthly_energy
data:
option: "{{ tariff }}"
The reason I’m suspicious of the napkin math in my head is that the Energy dashboard has my 5kWh used as equating to $331.xx
Would you have any insight into how to configure my daily_energy/monthly_energy sensors?
What values do you have for monthly_energy and electricity_price?
You don’t need any tariffs, however you do need to make sure the id of the utility meter matches the id referenced in the template sensor (which isn’t the case in your code).
I would make sure all values are calculated correctly before adding them to the energy dashboard. It’s hard to correct erroneous values later on.
Also, are you sure the threshold of 1000kWh is per month and not per year? 1000kWh per month seems like very very much.
Hi there, apologies for the delay, but thank you for your persistence. I will revisit the id of the utility meter against he template sensor like you mentioned.
I’d really like to iron this out to track my electric consumption. We are a family of 6 in a 5 bed/5 bath home, so our utilities are quite high.
As I mentioned, I’m pulling in my meter’s 900mHz signal via rtl_433 & MQTT. It is a Wh meter. When I was first tracking usage, my recordings were all over the place with the Wh/kWh conversion. For example, hourly usage was in the hundreds of kWh on the Energy dashboard. Wrong or right, I went into the database and manually set this and am getting more reasonable (although I’m not sure if they’re correct, of about 0.25-0.3 kWh):
Where I’m suspicious is, I have the mqtt sensor defined as Wh, but I wasn’t sure if that needed to be defined in the database, too? Or, should I have left the database value definition as kWh?
Ok. Seems like your units of measurement are off.
If your meter reports in Wh I wouldn’t artificially change that to kWh.
Instead it’s probably best to create a template sensor which converts Wh to kWh by dividing with 1000.