Thermostat for selectable Room

Hello :wave:

I am trying to come up with something that allows me to select the reference temperature of the thermostat. I thought about making a sensor that takes the value of another sensor based on an input select.

However, the code below doesn’t seem to work. Can someone tell me what am I doing wrong?
I believe I fixed it, But where can I learn more about the syntax?

# Room Selector for Thermostat Reference Temp
  - platform: template
    sensors:
      reference_room_temperature:
        friendly_name: "Reference Room Temperature"
        value_template: >-
          {% set p = (states('input_select.reference_room') | string)  %}
          {% if p == "Bedroom" %} 
              {{(states('sensor.bedroom_temperature') | float)  }}
          {% elif p == "Office" %} 
              {{(states('sensor.office_temperature') | float)  }}
          {% elif p == "Living" %}
              {{(states('sensor.office_temperature') | float)  }}
          {% else %}"Invalid"
          {% endif %}

Perhaps it is not the best solution. If so, then feel free to point me to the right direction.

Help Us Help You

1 Like

Thank you! I updated the previous post

1 Like

Templating, Jinja2, and a lot of practice :slight_smile:

1 Like