Problems with automation

I have this automation that works flawlessly, but if i add the transition: ‘400’, it doesn’t work anymore and no light are up at the desidered time…

- alias: Accendi Luce Camera Letto Notte
  trigger:
    platform: state
    entity_id: binary_sensor.motion_sensor_158d0001a92ca1
    to: 'on'
  condition:
    - condition: time
      after: 00:30:00
    - condition: sun
      before: 'sunrise'
      before_offset: "-00:30:00"
  action:
    - service: light.turn_on
      entity_id:
        - light.yeelight_3
        - light.yeelight_4
      data_template:
#        transition: '400'
        brightness: '25'
        rgb_color: ['{{ (range(0, 255)|random) }}','{{ (range(0, 255)|random) }}','{{ (range(0, 255)|random) }}']
    - delay: 00:00:45
    - service: light.turn_off
      entity_id:
        - light.yeelight_3
        - light.yeelight_4

Can somebody tell me why?

hmm. the docs appear to refer to transition at device definition in millisec but if you want to use transition in an automation this needs to be in seconds.

That’s probably why it’s doesn’t work, it’s just too slow.
Try transition: '4'

Hmmm i’ll try, but i have another automation:

- alias: Accendi Luce Corridoio Notte
  trigger:
    platform: state
    entity_id: binary_sensor.motion_sensor_158d0002006e75
    to: 'on'
  condition:
    - condition: time
      after: 00:20:00
    - condition: sun
      before: 'sunrise'
      before_offset: "-00:20:00"
  action:
    - service: light.turn_on
      entity_id: light.bedside_wifi
      data_template:
        transition: '400'
        brightness: '25'
        rgb_color: ['{{ (range(0, 255)|random) }}','{{ (range(0, 255)|random) }}','{{ (range(0, 255)|random) }}']
###### mode: last, normal, rgb, hsv, color_flow, moonlight ######
    - delay: 00:00:45
    - service: light.turn_off
      entity_id:
        - light.bedside_wifi

That works without any problem…

BTW, it works… thanks, you are always usefull… :grinning:

1 Like

it’s always 2 things, turn it off and back on or RTFM :smiley: