Hi
I have got two sensors:
- platform: template
sensors:
farenheit:
friendly_name: 'Temp in F'
value_template: '{{ (((states.sensor.temperature_158d000170b887.state|float)*1.8000)+32.00) }}'
unit_of_measurement: 'F'
if the value of the temperature is above 80F then I have created a sensor which does the calculation for real feel temperature which is given by:
- platform: template
sensors:
heat_index_1:
friendly_name: 'Real Feel Temp Above 80F in C'
#formula taken from http://www.srh.noaa.gov/ama/?n=heatindex
value_template: '{{ (((-42.379 + (2.04901523*(((states.sensor.temperature_158d000170b887.state|float)*1.8)+32)) + (10.14333127*(states.sensor.humidity_158d000170b887.state|float)) - (0.22475541*(((states.sensor.temperature_158d000170b887.state|float)*1.8)+32)*(states.sensor.humidity_158d000170b887.state|float)) - (6.83783 * (10**(-3))*((((states.sensor.temperature_158d000170b887.state|float)*1.8)+32)**2)) - (5.481717 * (10**(-2))*((states.sensor.humidity_158d000170b887.state|float)**2)) + (1.22874 * (10**(-3))*((((states.sensor.temperature_158d000170b887.state|float)*1.8)+32)**2*(states.sensor.humidity_158d000170b887.state|float))) + (8.5282 * (10**(-4))*((((states.sensor.temperature_158d000170b887.state|float)*1.8)+32)*(states.sensor.humidity_158d000170b887.state|float)**2)) - (1.99 * (10**(-6))*((((states.sensor.temperature_158d000170b887.state|float)*1.8)+32)**2)*((states.sensor.humidity_158d000170b887.state|float)**2)))-32)/1.8)|round(1) }}'
unit_of_measurement: '°Câ
and if the temperature is below 80F then there is another calculation which is given by:
- platform: template
sensors:
temp_below_80F:
friendly_name: 'Real Feel Temp Below 80F'
value_template: '{{ 0.5*(states.sensor.farenheit.state|float + 61.0 + ((states.sensor.farenheit.state|float-68.0)*1.2) + (states.sensor.humidity_158d000170b887.state*0.094)) }}'
unit_of_measurement: âF'
Now to present the 2 situations above is where I am having issues. I have the following:
- platform: template
sensors:
celsius:
friendly_name: 'Real Temp in C'
value_template: '{{ ((states.sensor.celsius.state|float)*1) }}'
unit_of_measurement: '°C'
The above is just a sensor I created. And the below is the main comparison used to change the identity of the above temperature.
- platform: template
sensors:
feel1:
friendly_name: âReal Feel in C"
value_template: >-
{% if states.sensor.farenheit.state|float < 80 %}
states.sensor.temp_below_80F.state == states.sensor.celsius.state
{% else %}
states.sensor.heat_index_1.state == states.sensor.celsius.state
{% endif %}
unit_of_measurement: âC'
I cannot get this to work as I get an error saying: [homeassistant.config] Invalid config for [sensor.template]: [temp_below_80F] is an invalid option for [sensor.template]
Can someone please help?
Thanks.