Randomise brightness (Cloudy weather effect)

Hello for everyone! I need a help.

I want to randomize brightness of my lamp but i haven’t got any idea how to realise it.

Time: brightness is changing randomly from 8 a.m. to 7 p.m.
Brighness: range from 50% to 100%.
Intensity: i have no idea how to control intensity (amount of brightness changing)

Important: Randomizing is doesn’t have relations with outside weather.

Example of effect in real life: 17 мая 2021 г. - YouTube

Just a little thing here.
I think you want to randomize the change in brightness, not the actual brightness.
It may seem as the same thing but trust me, it’s not.

You give it a range of 50-100 and the change can be 0-10.

So current brightness is 60, but it can only be 50-70 with the next change.
If you don’t have this limit then it will become very unstable and look bad.

I did this on an arduino project a few years ago.

Make the duration of the change a variable with some randomness to make it look even more alive.

1 Like

I just did a little test and it seems to work.

If you want a variable delay then use the same setup on the delay as I did with brightness.
This is only as long as the light is on, but I guess that can be changed or you have a separate automation to turn on/off the lamp.

alias: Taklampan (Duplicate)
description: ''
trigger:
  - platform: state
    entity_id: light.taklampa
    to: 'on'
    from: 'off'
condition: []
action:
  - service: light.turn_on
    data:
      brightness: 127
    target:
      entity_id: light.taklampa
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - repeat:
      until:
        - condition: state
          entity_id: light.taklampa
          state: 'off'
      sequence:
        - service: light.turn_on
          data:
            brightness_step_pct: '{{ ["","-"] | random }}{{ range(1, 10) | random }}'
          target:
            entity_id: light.taklampa
        - delay:
            hours: 0
            minutes: 0
            seconds: 4
            milliseconds: 0
mode: single
1 Like

“So current brightness is 60, but it can only be 50-70 with the next change.
If you don’t have this limit then it will become very unstable and look bad.” I didn’t think about it…really important thing.

Thank you a lot! I will try your automatisation today.