Hi,
very new to templating and still struggling to get my head around where and how I can use it. I’ve setup a utility meter, but the offset changes monthly due to our different billing cycles. I’ve tried the following:
utility_meter:
monthly_energy:
source: sensor.energy_consumed
cycle: monthly
offset:
days: >
{% if now().month == 4 %}
17
{% elif now().month == 5 %}
20
{% elif now().month == 6 %}
20
{% elif now().month == 7 %}
17
{% elif now().month == 8 %}
20
{% elif now().month == 9 %}
18
{% elif now().month == 10 %}
17
{% elif now().month == 11 %}
19
{% elif now().month == 12 %}
19
{% elif now().month == 1 %}
18
{% elif now().month == 2 %}
19
{% elif now().month == 3 %}
19
{%- else -%}
0
{%- endif %}
I’m getting an error. Just want to know if what I’m trying to do is possible, and if yes what am I missing?