Hi all. Please assist with the following. Not sure which part of this is incorrect. It must definitely be the conversion of a value somewhere but not sure which one.
{% set mode = states('input_select.regulator_mode') | lower%}
{% set power = states('input_select.regulator_power') | lower%}
{% set tempHeat = states('input_select.regulator_temp_heat') %}
{% set tempCool = states('input_select.regulator_temp_cool') %}
{% set time = states('input_select.regulator_speed') %}
{% set temperature = states('sensor.temperature_2') %}
{% set humidity = states('sensor.humidity_2') %}
{% if temperature < tempHeat %}
{% if tempHeat - temperature <= '0.5' %}
{% if power == 'Passive' %}
script.regulator_heat_03
{% elif power == 'Aggressive' %}
script.regulator_heat_03
{% endif %}
{% elif tempHeat - temperature <= '1.0' %}
{% if power == 'Passive' %}
script.regulator_heat_03
{% elif power == 'Aggressive' %}
script.regulator_heat_06
{% endif %}
{% elif tempHeat - temperature <= '1.5' %}
{% if power == 'Passive' %}
script.regulator_heat_06
{% elif power == 'Aggressive' %}
script.regulator_heat_09
{% endif %}
{% elif tempHeat - temperature <= '2.5' %}
{% if power == 'Passive' %}
script.regulator_heat_09
{% elif power == 'Aggressive' %}
script.regulator_heat_12
{% endif %}
{% elif tempHeat - temperature > '2.5' %}
script.regulator_heat_15
{% endif %}
{% elif temperature > tempCool %}
{% if temperature - tempCool <= '0.5' %}
{% if power == 'Passive' %}
script.regulator_cool_passive
{% elif power == 'Aggressive' %}
script.regulator_cool_low
{% endif %}
{% elif temperature - tempCool <= '1.0' %}
{% if power == 'Passive' %}
script.regulator_cool_low
{% elif power == 'Aggressive' %}
script.regulator_cool_medium
{% endif %}
{% elif temperature - tempCool <= '1.5' %}
{% if power == 'Passive' %}
script.regulator_cool_medium
{% elif power == 'Aggressive' %}
script.regulator_cool_high
{% endif %}
{% elif temperature - tempCool <= '2.5' %}
{% if power == 'Passive' %}
script.regulator_cool_medium
{% elif power == 'Aggressive' %}
script.regulator_cool_high
{% endif %}
{% elif temperature - tempCool > '2.5' %}
script.regulator_cool_high2
{% endif %}
{% endif %}
The general way to debug something is to remove copy paste everything to notepad and remove everything from your template then add one line at the time (except the if else part) to the template tool in developer tools, and see when the error occurs.
To anyone coming here for an answer: Doing it the following way works. Now i just need to figure out how to convert this to a service template to call the returned value as a service.
{% set mode = states('input_select.regulator_mode') %}
{% set power = states('input_select.regulator_power') %}
{% set tempHeat = states('input_select.regulator_temp_heat') %}
{% set tempCool = states('input_select.regulator_temp_cool') %}
{% set time = states('input_select.regulator_speed') %}
{% set temperature = states('sensor.temperature_2') %}
{% set humidity = states('sensor.humidity_2') %}
{% set tempvaldifLow = ( states('input_select.regulator_temp_heat') | float | round(1)) - ( states('sensor.temperature_2') | float | round(1)) %}
{% set tempvaldifHigh = ( states('sensor.temperature_2') | float | round(1)) - ( states('input_select.regulator_temp_cool') | float | round(1)) %}
{% if temperature < tempHeat %}
{% if tempvaldifLow <= 0.5 %}
{% if power == 'Passive' %}
script.regulator_heat_03
{% elif power == 'Aggressive' %}
script.regulator_heat_03
{% endif %}
{% elif tempvaldifLow <= 1.0 %}
{% if power == 'Passive' %}
script.regulator_heat_03
{% elif power == 'Aggressive' %}
script.regulator_heat_06
{% endif %}
{% elif tempvaldifLow <= 1.5 %}
{% if power == 'Passive' %}
script.regulator_heat_06
{% elif power == 'Aggressive' %}
script.regulator_heat_09
{% endif %}
{% elif tempvaldifLow <= 2.5 %}
{% if power == 'Passive' %}
script.regulator_heat_09
{% elif power == 'Aggressive' %}
script.regulator_heat_12
{% endif %}
{% elif tempvaldifLow > 2.5 %}
script.regulator_heat_15
{% endif %}
{% elif temperature > tempCool %}
{% if tempvaldifHigh <= '0.5' %}
{% if power == 'Passive' %}
script.regulator_cool_passive
{% elif power == 'Aggressive' %}
script.regulator_cool_low
{% endif %}
{% elif tempvaldifHigh <= '1.0' %}
{% if power == 'Passive' %}
script.regulator_cool_low
{% elif power == 'Aggressive' %}
script.regulator_cool_medium
{% endif %}
{% elif tempvaldifHigh <= '1.5' %}
{% if power == 'Passive' %}
script.regulator_cool_medium
{% elif power == 'Aggressive' %}
script.regulator_cool_high
{% endif %}
{% elif tempvaldifHigh <= '2.5' %}
{% if power == 'Passive' %}
script.regulator_cool_medium
{% elif power == 'Aggressive' %}
script.regulator_cool_high
{% endif %}
{% elif tempvaldifHigh > '2.5' %}
script.regulator_cool_high2
{% endif %}
{% endif %}