{% set energy = states('sensor.state_grid_4301459303xxx_month_ele_num') | float %}
{% set month = now().month %}
{% set spring_autumn = [3, 4, 5, 9, 10, 11] %}
{% set winter_summer = [1, 2, 6, 7, 8, 12] %}
{% if energy < 200 %}
1
{% elif energy < 350 and month in spring_autumn %}
2
{% elif energy < 450 and month in winter_summer %}
2
{% elif energy >= 350 and month in spring_autumn %}
3
{% elif energy >= 400 and month in winter_summer %}
3
{% endif %}
{% set energy = states('sensor.state_grid_4301459303xxx_month_ele_num') | float %}
{% set month = now().month %}
{% set spring_autumn = [3, 4, 5, 9, 10, 11] %}
{% set winter_summer = [1, 2, 6, 7, 8, 12] %}
{% if energy < 200 %}
0.588
{% elif energy < 350 and month in spring_autumn %}
0.638
{% elif energy < 450 and month in winter_summer %}
0.638
{% elif energy >= 350 and month in spring_autumn %}
0.888
{% elif energy >= 400 and month in winter_summer %}
0.888
{% endif %}