Template sensor state=None

I try to create a state for a templete sensor for yes and no by comparing a value of two different values and this seems not to work.

What I did was:

- platform: template
  sensors:
    heizen_bad:
      friendly_name: 'Bad aufheizen'
      value_template: >-
                    {%- if is_state(states.sensor.eurotronic_eur_cometz_wall_radiator_thermostat_valve_control_temperature_8_1.state < states.input_slider.temperatur_bad.state ) -%}
               Ja
          {%- else -%}
              Nein
          {%- endif -%}  

The state of sensor.eurotronic_eur_cometz_wall_radiator_thermostat_valve_control_temperature_8_1 is 23
and the state of input_slider.temperatur_bad is 25, so it should be “Ja”, but it looks like an wrong syntax.

Dec 28 21:37:24 home-assistant hass[11883]: 16-12-28 21:37:24 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=None, entity_id=sensor.heizen_bad, new_state=<state sensor.heizen_bad=unknown; friendly_name=Bad aufheizen @ 2016-12-28T22:37:24.838288+01:00>>

  value_template: >-
      {%- if is_state((states("sensor.eurotronic_eur_cometz_wall_radiator_thermostat_valve_control_temperature_8_1") | int) < (states("input_slider.temperatur_bad") | int)) -%}

…is also not working
Any idea?

Why do you want use is_state()? That only returns true/false which makes no sense with the <-operator.
Playing a bit with the dev-tool, this syntax would work for me (it serves no purpose though - I just picked a random slider and a thermostat from my setup):

{%- if states.input_slider.heating_bathroom_morning.state | int  < states.climate.danfoss_z_thermostat_014g0013_heating_1_3_1.attributes.temperature | int -%}
Yes
{%- else -%}
No
{%- endif %}

Sebastian

@sebk-666
Sometimes live could be so easy if you just think like human being. Thanks for that advice