I have the below config, based on the how-to documentation… Turn on a light when motion detected, wait a period of time, then turn it off. This works, except for the brightness setting.
I would like the brightness increased to 100% with a three-second transition, and reduce the brightness to 50% before turning it off, with a five-second transition.
First, do I have the brightness coded correctly? Secondly, I understand “light.turn_off” has a problem with setting brightness level; is there another to do this?
- alias: Office Motion Light On
trigger:
platform: state
entity_id: binary_sensor.office_motion_detector_motion
to: 'on'
condition:
condition: time
after: '19:00'
before: '08:00'
action:
service: homeassistant.turn_on
entity_id: light.office_floor_lamp
data:
brightness_pct: '100'
transition: 3
- alias: Office Motion Light Off
trigger:
- platform: state
entity_id: binary_sensor.office_motion_detector_motion
to: 'off'
for:
minutes: 3
action:
- service: homeassistant.turn_off
entity_id: light.office_floor_lamp
data:
brightness_pct: '50'
transition: 5
In the second automation, change it to turn_on with the brightness at 50 percent and a 5 second transition, then call the turn_off service. I think you’ll also need a delay equal to the transition time between the turn_on and turn_off service calls.