Hi guys, I’m really struggling here with trying to increase and decrease my brightness with an automation.
I’ve tried all of the below with now luck.
Brightness 4 will change the brightness to 100 on the Dimmer in console.
Brightness 2 will just set the brightness_pct value to the initial 50
- alias: 'Brightness3'
trigger:
platform: state
entity_id: binary_sensor.dimtest
action:
- service: light.turn_on
entity_id: light.lamp4
data_template:
brightness: >-
{{ states.light.lamp4.attributes.brightness | int + 10 }}
- alias: 'Brightness4'
trigger:
platform: state
entity_id: binary_sensor.dimtest
action:
- service: light.turn_on
entity_id: light.lamp4
data_template:
brightness: '{{states.light.lamp4.attributes.brightness + 10}}'
- alias: 'Brightness'
trigger:
platform: state
entity_id: binary_sensor.dimtest
action:
- service: light.turn_on
entity_id: light.lamp4
data_template:
brightness: >
{% set suggested = states.light.lamp4.attributes.brightness |int + 10 %}
{% if suggested < 200 %}
{{ suggested }}
{% else %}
200
{% endif %}
- alias: 'Brightness2'
trigger:
platform: event
event_type: click
event_data:
entity_id: binary_sensor.button_id
click_type: single
action:
- service: light.turn_on
entity_id: light.lamp4
data_template:
brightness_pct: >
{% set step_size = 50 %}
{% set cb = (state_attr('light.lamp4', 'brightness') | float / 255.0) * 100.0 %}
{% set new_brightness = cb | int + step_size %}
{% if 91 <= new_brightness < (90 + step_size) %}
100
{% else %}
{{ new_brightness if new_brightness < 100 else 0 }}
{% endif %}