Input_select and input_slider Help Please

exactly! - this is also why I said earlier that you will have to solve for the service template; I currently have the same situation and use 2 separate sliders. I built a card for heating and one for cooling. I was going to attempt to hide them, but you’ve given me a new idea if the service template will work.

Your current sensor should be:

  - platform: template
    sensors:
      heat_setpoint:
        value_template: "{{ states.climate.trane_model_tzemt400ab32maa_heating_1_34_1.attributes.temperature | int }}"
        friendly_name: "Heating Setpoint"

then use that sensor value in the automation to return the slider. Taking that a step further, you’ll create another sensor for cooling:

  - platform: template
    sensors:
      cool_setpoint:
        value_template: "{{ states.climate.trane_model_tzemt400ab32maa_cooling_1_34_2.attributes.temperature | int }}"
        friendly_name: "Cooling Setpoint"

and use the service template method to call either one in your automation (in theory, I’ve not tested that yet).

When you get it working, please post the final version here so we can see!

I have not yet gotten this to work. Maybe my logic is warped here, but follow me on this and show me where I am going wrong.

So I use the following in the attempt to update the slider value upon the setpoint being changed at the thermostat itself:

  - alias: Set Slider Setpoint
    trigger:
      - platform: state
        entity_id: sensor.hvac_setpoint
    action:
      service: input_slider.select_value
      data_template:
        entity_id: input_slider.hvac_temp
        value: '{{ states.sensor.trane_model_tzemt400ab32maa_temperature_34_1.state | int }}'

Now, the trigger is the sensor that was set up sensor.hvac_setpoint. and the action is being taken on the input slider, input_slider.hvac_temp so that it matches the integer value of:

{{ states.sensor.trane_model_tzemt400ab32maa_temperature_34_1.state | int }}

But this seems backward to me (again, give me room that my logic is off/warped/jacked, etc.). We are TRIGGERING off the created sensor. That says to me when something happens here (the trigger) do this. Sort of an If/Then statement.

However, I am wanting to update the slider based on the thermostat temperature setpoint, which is derived from:

{{ states.climate.trane_model_tzemt400ab32maa_cooling_1_34_2.attributes.temperature | int }}

Not

{{ states.sensor.trane_model_tzemt400ab32maa_temperature_34_1.state | int }}

So should not the above be:

  - alias: Set Slider Setpoint
    trigger:
      - platform: state
        entity_id: sensor.hvac_setpoint
    action:
      service: input_slider.select_value
      data_template:
        entity_id: input_slider.hvac_temp
        value: '{{ states.climate.trane_model_tzemt400ab32maa_cooling_1_34_2.attributes.temperature | int }}'

???

Better still, perhaps:

  - alias: Set Slider Setpoint
    trigger:
      - platform: state
        entity_id: states.climate.trane_model_tzemt400ab32maa_heating_1_34_1.attributes.temperature
    action:
      service: input_slider.select_value
      data_template:
        entity_id: input_slider.hvac_temp
        value: sensor.hvac_setpoint

Something like that?

OK
sensor.hvac_setpoint
is the currently set temperature of the thermostat. Let’s say 72.

Here is the breakdown of what should happen:

- alias: Set Slider Setpoint
    trigger:
# when the thermostat setting changes...
      - platform: state
        entity_id: sensor.hvac_setpoint


# update the input_slider entity:    
    action:
      service: input_slider.select_value


# to match the value of the temperature that was selected:
      data_template:
        entity_id: input_slider.hvac_temp
        value: '{{ states.sensor.hvac_setpoint.state | int }}'

Further,

value: '{{ states.sensor.hvac_setpoint.state | int }}' means:
“Set the value of my input slider to whatever numeric integer value the thermostat is set to " RIGHT NOW” which should be equal to whatever it was set to in the TRIGGER.

So, if the thermostat value were set to 78 …

sensor.hvac_setpoint now equals 78 and “action” will apply that value to the input slider value.

Make sense? Note that I changed your code slightly, in that I modified the last “value”

I guess I need to get my head, somewhat, out of the If/Then, If/Then Else, Do/While loop kind of mindset as HA does not seem to quite follow that logic, rather more of a state-based logic.

Thank you for posting that as I am sure I will be coming back to it many times to keep me going in the right logic direction. Still have not been able to get the slider to act correctly. Though, there has been progress in that it does change now in response to ‘something’ which even that was not happening prior to your help.

I am beginning to wonder if perhaps there is something missing in all this, some parameter I do not know how to call or access. The thermostat sensor is just (as far as I can determine) the room/air temperature the thermostat sees. The other two entities hold all the attributes for either mode, heating or cooling.

Or maybe I just need to upgrade to an Ecobee or something, LOL. This thermostat is a ZWave thermostat I bought when I very first started using home automation roughly 6 years ago.

keep posting your config and symptoms and we will get you through it. Good luck!

Hi guys, I’m now following this trying to do something similar to mine, but I believe I have a more simple request/need. All I want is a slider that allows me to change the temperature up or down. My system is always set to HOLD temp so I just need to be able to move the desired temp up or down I’ve tried a few different things but it’s just not working… Here’s my setup:

Thermostat (Radio Thermostat, inside my configuration.yaml)

climate:
  - name: Thermostat
    platform: radiotherm
    host:
      - 192.168.1.8
    hold_temp: True

Sensor (inside my sensors.yaml):

  - platform: template
    sensors:
      current_set_temp:
        value_template: "{{ states.climate.main.attributes.temperature | int }}"
        friendly_name: "Current Set Temp"

Automation (inside my automation.yaml):

- alias: 'Set temp slider'
  trigger:
    - platform: state
      entity_id: sensor.current_set_temp
  action:
    service: input_slider.select_value
    data_template:
      entity_id: input_slider.target_temp
      value: '{{ sensor.current_set_temp | int }}

Input slider (inside my input_sliders.yaml):

  target_temp:
    name: Target Temperature
    min: 55
    max: 73
    step: 1
    initial: 68
    unit_of_measurement: step
    icon: mdi:target

What’s showing up for my climate.main under attributes:

fan: Auto
unit_of_measurement: °F
operation_list: auto,cool,heat,off
mode: Heat
away_mode: off
operation_mode: heat
entity_picture: /local/Thermostat_2.png
friendly_name: Thermostat
min_temp: 44.6
current_temperature: 67
temperature: 62
max_temp: 95

What’s showing up for my climate.main under state:

heat

also, once seasons change switch from mode of HEAT to COOL --I can deal with changing the mode later, just want to have a slider to set temp for now :wink:

Hopefully I’ve posted enough info to help you gather where I’m going wrong??? Thanks in advance!

@automateit found your discussion on the thermostat sensors. Instead of an input_slider, I used an input_select. My automation looks the same at yours, and it works properly. Only problem is resetting home-assistant, the initial value for the input_select is not set to the actual sensor proper value. Not sure if you have seeing a similar behavior
Thanks

I believe that this is addressed in 0.42, just released yesterday.

“If you set an initial state for an automation, input_boolean, input_slider or input_select it will overrule over the previous state. #6911 #6924

So, your initial state setting should stick if you reset once you update home assistant.

1 Like

Updated to 0.42.3 and still seeing the same issue. During HASS start up, it seems the values for the Zwave climate’s components randomly change. This can cause the Thermostat to go on a wild state lowering the home temp excessively, concerning if I’m not at home and have a power failure rebooting HASS.

Here is my config, An automation triggered from the Zwave state updates the value of an input_selection

alias: ac3 change on cool temp
trigger:
  platform: state
  entity_id: climate.trane_model_tzemt400bb32maa_cooling_1_5_2
action:
  - service: input_select.select_option
    data:
      entity_id: input_select.cool3target
    data_template:
      option: '{{ states.climate.trane_model_tzemt400bb32maa_cooling_1_5_2.attributes.temperature }}'

another automation triggers when the input_select value changes

alias: ac3 cool target selected
trigger:
  platform: state
  entity_id: input_select.cool3target
condition:
  condition: template
  value_template: '{{ states.input_select.cool3target.state != states.climate.trane_model_tzemt400bb32maa_cooling_1_5_2.attributes.temperature }}'
action:
  service: climate.set_temperature
  entity_id: climate.trane_model_tzemt400bb32maa_cooling_1_5_2
  data_template:
    temperature: "{{ states('input_select.cool3target') }}"

Are you using an “initial state” on your input_select component(s)?
I set all of mine to an arbitrary value: “Select an option…” and use an automation to reset the selection each time a new setting is chosen.

Look at my configs for more info on those:
https://github.com/rrubin0/homeassistant-config/blob/master/input_select.yaml

Admittedly, I have “dumbed down” my HVAC automations a bit, but do plan to slowly add back a few. Things are working well at the moment and summer is upon us, so I need to tread lightly. :slight_smile:

This!!

I’m trying to get my input select to reset after each time I’ve selected a value but I’m not getting it to stick! Can you share your solution?

Best regards
John