#Is there an easier way to make this automation

9 messages · Page 1 of 1 (latest)

indigo jolt
#

Im fairly new to home assistant, is there an easier way to dim my lights using a sliding potentiometer than making 30 automations for each value. the automation is for controlling room lights not the status leds

modest hazel
#

You can use a template to set the brightness ... you'll need to calculate how you want to translate the slider input to the brightness %

#

Looks like it already might be a standard 0-1 float, so just multiplying by 100 should do that for you

indigo jolt
#

Like this?

automation:

  • alias: "Adjust Light Brightness with Slider"
    trigger:
    • platform: state
      entity_id: sensor.brightness_slider
      action:
    • service: light.turn_on
      target:
      entity_id: light.my_light
      data:
      brightness: >
      {% set brightness = states('sensor.brightness_slider') | float %}
      {{ (brightness * 2.55) | round(0) }}
#

my potentiometer value ranges from .02-.26

modest hazel
#

Hmm... no, that won't work if you want it to dim

#

brightness also goes from 0-255, whereas brightness_pct is 0-100

#

brightness_pct could be something like "{{ (((states('sensor.brightness_slider') | float) - 0.02) / 0.0024) | round() }}"

indigo jolt
#

that was it thank you very much!!