Hi there, I have been reading a lot here in the forums and the official docs for Template and Templating but still not get this working.
I am trying to calculate the costs of my current energy usage at home. To get the values I have installed and configured the AMR2MQTT addon.
First, these are the charges as per my monthly bill:
Then this is what my sensor code looks like:
template:
- sensor:
- name: "Electricity Price"
unit_of_measurement: "$"
state: >
{% set consumption = states('sensor.energy_meter_consumption') | float(0) %}
{% if consumption < 1000 %}
{% set factor=0.10489 %}
{% else %}
{% set factor=0.10714 %}
{% endif %}
{{ consumption * factor + 0.055 }}
However, if try to use the sensor from the Grid Consumption I cannot find it anywhere:
I tried to setup the Utility Meter helper to track the costs but is not clear to me how to set the tariff properly so it uses 0.10489
if consumption < 1000
or 0.10489
if it is above.
Can I get some help? What I am missing here?