UI Slider that Influences Values for Automation

I want to configure a slider in lovelace to set the temperature that then influences an automation, is this possible?

For example if I set the temperature to 25 degrees, whenever the temperature exceeds that, a cooling system will turn on. I already have the cooling automation working, I just want a simpler way to configure the temperature value other than having to manually change values in the config.

Yes it is possible by using a template trigger.

Great! I’ll give that a look, thanks :slight_smile:

And create an input_number to hold the temperature that you want to change.

Hey, does this automation make sense? Hard to actually test without the temperature reaching these thresholds.

- alias: Decrease Temperature-On
  trigger:
    - platform: time_pattern
      minutes: '/5'
  condition:
    - condition: template
      value_template: '{{ states.sensor.dht_sensor_temperature.state | float > input_number.temperature }}'
  action:
    service: switch.turn_on
    entity_id: switch.cool
``````````````````````````````````````````````

Time pattern triggers are rarely the most efficent way to do things. Better to trigger on change of state of your sensor or the input number.

- alias: Decrease Temperature-On
  trigger:
    - platform: state
      entity_id: 
        - sensor.dht_sensor_temperature
        - input_number.temperature
  condition:
    - condition: template
      value_template: "{{ states('sensor.dht_sensor_temperature')|float > states('input_number.temperature')|float }}"
  action:
    service: switch.turn_on
    entity_id: switch.cool

Also the value for your input number was not correctly accessed in the template and I changed the template format to the preferred version that does not error if the state is unavailable. See the warning in yellow here: https://www.home-assistant.io/docs/configuration/templating/#states

If I’m not mistaken I think we will soon (HA 0.115) have the ability to use input_number directly in the trigger rather than having to use templates

1 Like

Why not use a template trigger instead of trigger on entity change + condition? Am I missing something?

That would be a better way.